https://llvm.org/bugs/show_bug.cgi?id=23831

            Bug ID: 23831
           Summary: deleting null pointer indirection is far too
                    aggressive
           Product: clang
           Version: trunk
          Hardware: All
                OS: All
            Status: NEW
          Severity: normal
          Priority: P
         Component: -New Bugs
          Assignee: [email protected]
          Reporter: [email protected]
                CC: [email protected], [email protected], [email protected],
                    [email protected], [email protected],
                    [email protected]
            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
'volatile'
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
adoption.

-- 
You are receiving this mail because:
You are on the CC list for the bug.
_______________________________________________
LLVMbugs mailing list
[email protected]
http://lists.cs.uiuc.edu/mailman/listinfo/llvmbugs

Reply via email to