diff options
| author | eunhhu <[email protected]> | 2026-10-01 16:29:41 +0100 |
|---|---|---|
| committer | eunhhu <[email protected]> | 2026-10-01 16:29:41 +0100 |
| commit | 2963fb5a7deb0cca24c3aa410a11ebc0f8fb559a (patch) | |
| tree | 7be5b3f376664279e9f7890d236c44457f79644c /core/module-list.c | |
| parent | 83286a0722be240690c134d9c6c75b2da6e94e8a (diff) | |
| download | pure-2963fb5a7deb0cca24c3aa410a11ebc0f8fb559a.tar.gz pure-2963fb5a7deb0cca24c3aa410a11ebc0f8fb559a.zip | |
Read a list cell's place after finding its leaf, not beside it
pure_list_get passed leaf_of(list, at, &within) and within to cell_at
in one call: C leaves the order of a call's arguments open, so within
could be read before leaf_of set it. gcc 14 on AArch64 called leaf_of
first; gcc 13 on x86_64 says within is used uninitialized (found
building Pure there, research 029).
Diffstat (limited to 'core/module-list.c')
| -rw-r--r-- | core/module-list.c | 3 |
1 files changed, 2 insertions, 1 deletions
diff --git a/core/module-list.c b/core/module-list.c index ac622cc..1f3b900 100644 --- a/core/module-list.c +++ b/core/module-list.c @@ -1087,7 +1087,8 @@ PureResult pure_list_set(PureList *list, size_t at, unsigned field, PureCell val PureCell pure_list_get(const PureList *list, size_t at, unsigned field) { size_t within; - return cell_at(&list->layout, leaf_of(list, at, &within), (unsigned)within, field); + const Node *leaf = leaf_of(list, at, &within); /* first: an argument beside it would be read in either order */ + return cell_at(&list->layout, leaf, (unsigned)within, field); } static void open_run(const Layout *l, const Node *leaf, PureRun *run) { |
