Last active
April 19, 2018 17:08
-
-
Save ElvishJerricco/5f3baeb27ffc54d06385725a7ce5eff8 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#define NUM 16 | |
int foo[] = {0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, | |
0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, | |
0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, | |
0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0}; | |
int *bar = ((int *)&foo) + NUM; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/usr/bin/env bash | |
set -eu | |
CC="clang --target=wasm32-unknown-unknown-wasm -nostdlib" | |
$CC -c test.c -o test1.o | |
$CC -r test1.o -o test2.o | |
$CC -r test2.o -o test3.o |
Interestingly, whether or not this breaks depends on that NUM
being 16. If NUM >= 16 && NUM < 32
, it breaks. But if NUM < 16 || NUM >= 32
, it works. EDIT: "works" as in it exits cleanly; I guess I'm not really sure how to verify that it's correct.
Fix is here: https://reviews.llvm.org/D45825. Thanks for tracking that down!
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Output: