[llvm-bugs] [Bug 25189] New: Compiling at -O2 with atomics removes a null check resulting in a segfault at run time
via llvm-bugs
llvm-bugs at lists.llvm.org
Wed Oct 14 17:52:46 PDT 2015
https://llvm.org/bugs/show_bug.cgi?id=25189
Bug ID: 25189
Summary: Compiling at -O2 with atomics removes a null check
resulting in a segfault at run time
Product: new-bugs
Version: trunk
Hardware: PC
OS: Linux
Status: NEW
Severity: normal
Priority: P
Component: new bugs
Assignee: unassignedbugs at nondot.org
Reporter: rtrieu at google.com
CC: jfb at google.com, llvm-bugs at lists.llvm.org
Classification: Unclassified
Created attachment 15081
--> https://llvm.org/bugs/attachment.cgi?id=15081&action=edit
Test case
After r216980, Clang is miscompiling code with atomics such that a null check
is removed causing a segfault shortly after.
Compiling the code with:
clang++ -O2 --std=c++11 test.cc
will produce a binary that segfaults in the function "DoStuff" on
"++data->counter;" even though two lines before it, a null check is performed
with "if (data == nullptr) return;". Compiling without -O2 will not produce a
segfault.
--
You are receiving this mail because:
You are on the CC list for the bug.
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.llvm.org/pipermail/llvm-bugs/attachments/20151015/f5a07850/attachment.html>
More information about the llvm-bugs
mailing list