wasi-libc: compile emmalloc.c without strict aliasing (#16157)
emmalloc.c does a fair amount of type punning in order to access
the size of memory regions and traverse them.
Unfortunately, that can lead to unwanted optimizations.
This simple test case currently triggers a memory fault:
int main(void) {
char * volatile p = malloc(1);
p = realloc(p, 12);
p = malloc(1);
printf("%p\n", p);
}
Work around this by adding "-fno-strict-aliasing" when compiling
that file.
e7f872c9c6Frank Denis committed on 6/25/2023, 9:24:54 AM· committed by GitHubparentb111702