[LLVMbugs] [Bug 23831] New: deleting null pointer indirection is far too aggressive

bugzilla-daemon at llvm.org bugzilla-daemon at llvm.org
Fri Jun 12 10:07:07 PDT 2015


            Bug ID: 23831
           Summary: deleting null pointer indirection is far too
           Product: clang
           Version: trunk
          Hardware: All
                OS: All
            Status: NEW
          Severity: normal
          Priority: P
         Component: -New Bugs
          Assignee: unassignedclangbugs at nondot.org
          Reporter: danalbert at google.com
                CC: chh at google.com, enh at google.com, llvmbugs at cs.uiuc.edu,
                    nlewycky at google.com, srhines at google.com,
                    timmurray at google.com
            Blocks: 21420
    Classification: Unclassified

$ cat foo.cpp
int main() {
    *(int*)0 = 0;
$ clang++ foo.cpp
foo.cpp:2:3: warning: indirection of non-volatile null pointer will be deleted,
not trap [-Wnull-dereference]
  *(int*)0 = 0;
foo.cpp:2:3: note: consider using __builtin_trap() or qualifying pointer with
1 warning generated.

This is far too aggressive. It's very obvious what the user wanted (each case
of this I've had to clean up in android had a comment like "force a crash".

Yes, the user almost always wanted abort() or __builtin_trap() rather than what
they wrote, but we can't rewrite the world's code over night, so this hinders

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/20150612/57690b43/attachment.html>

More information about the llvm-bugs mailing list