Skip to content

Commit

Permalink
Adding an attribute to test_main to prevent clang 14 from inlining it…
Browse files Browse the repository at this point in the history
… an reordering locals, causing stack roots to become lost. Working around GitHub issue #210 <#210>.
  • Loading branch information
rptb1 committed Apr 14, 2023
1 parent 24e4c86 commit 627ded3
Showing 1 changed file with 2 additions and 1 deletion.
3 changes: 2 additions & 1 deletion code/extcon.c
Original file line number Diff line number Diff line change
Expand Up @@ -204,6 +204,7 @@ static mps_addr_t obj_isfwd(mps_addr_t addr)
}
}

ATTRIBUTE_NOINLINE
static void test_main(void *cold_stack_end)
{
mps_res_t res;
Expand All @@ -221,7 +222,7 @@ static void test_main(void *cold_stack_end)
main and lose this condition if the expression below is removed.
This is a problem we are analysing in GitHub issue #210
<https://github.com/Ravenbrook/mps/issues/210>. */
Insist((void *)&testobj[N_TESTOBJ] < cold_stack_end);
Insist((void *)&testobj[N_TESTOBJ] <= cold_stack_end);

/* Make initial arena size slightly bigger than the test object size to force an extension as early as possible */
obj_size = ALIGN_OBJ(sizeof(test_alloc_obj_s));
Expand Down

0 comments on commit 627ded3

Please sign in to comment.