[LLVMdev] Bug Report -- Possible optimizer bug with thread_local variables

Hans Wennborg hans at chromium.org
Fri Nov 9 17:34:52 PST 2012


On Fri, Nov 9, 2012 at 4:54 PM, Tom Bergan <tbergan at cs.washington.edu>
> The bug manifests
> more simply if the variables "Ptr" and "Foo" are declared static -- in this
> case, the bug is demonstrated directly with "clang -O3".
>
> Attached are three files:
> * test.c, which is the same as the old test.c, but with "Ptr" and "Foo"
> declared static
> * test.0.ll, which was built with "clang -emit-llvm -S -O0 test.c -o
> test.0.ll"
> * test.3.ll, which was built with "clang -emit-llvm -S -O3 test.c -o
> test.3.ll"
>
> To demonstrate the bug (verified with revision 167568):
> $ clang -O3 -lpthread test.c -o test
> $ ./test   # prints "Foo: 0"
>
> It is also pretty clear that "test.3.ll" is an incorrect optimization of
> "test.0.ll"

This looks like a bug indeed. Can you please file it at http://llvm.org/bugs/ ?

Thanks,
Hans



More information about the llvm-dev mailing list