Submitted as <a href="http://llvm.org/bugs/show_bug.cgi?id=14309">http://llvm.org/bugs/show_bug.cgi?id=14309</a><br><br><div class="gmail_quote">On Fri, Nov 9, 2012 at 5:34 PM, Hans Wennborg <span dir="ltr"><<a href="mailto:hans@chromium.org" target="_blank">hans@chromium.org</a>></span> wrote:<br>
<blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">On Fri, Nov 9, 2012 at 4:54 PM, Tom Bergan <<a href="mailto:tbergan@cs.washington.edu">tbergan@cs.washington.edu</a>><br>

<div class="im">> The bug manifests<br>
> more simply if the variables "Ptr" and "Foo" are declared static -- in this<br>
> case, the bug is demonstrated directly with "clang -O3".<br>
><br>
> Attached are three files:<br>
> * test.c, which is the same as the old test.c, but with "Ptr" and "Foo"<br>
> declared static<br>
> * test.0.ll, which was built with "clang -emit-llvm -S -O0 test.c -o<br>
> test.0.ll"<br>
> * test.3.ll, which was built with "clang -emit-llvm -S -O3 test.c -o<br>
> test.3.ll"<br>
><br>
> To demonstrate the bug (verified with revision 167568):<br>
> $ clang -O3 -lpthread test.c -o test<br>
> $ ./test   # prints "Foo: 0"<br>
><br>
> It is also pretty clear that "test.3.ll" is an incorrect optimization of<br>
> "test.0.ll"<br>
<br>
</div>This looks like a bug indeed. Can you please file it at <a href="http://llvm.org/bugs/" target="_blank">http://llvm.org/bugs/</a> ?<br>
<br>
Thanks,<br>
Hans<br>
</blockquote></div><br>