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: unassignedb...@nondot.org
          Reporter: rtr...@google.com
                CC: j...@google.com, llvm-bugs@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.
_______________________________________________
llvm-bugs mailing list
llvm-bugs@lists.llvm.org
http://lists.llvm.org/cgi-bin/mailman/listinfo/llvm-bugs

Reply via email to