[LLVMbugs] [Bug 11876] New: missed null dereference warning

bugzilla-daemon at llvm.org bugzilla-daemon at llvm.org
Fri Jan 27 19:52:13 PST 2012


http://llvm.org/bugs/show_bug.cgi?id=11876

             Bug #: 11876
           Summary: missed null dereference warning
           Product: clang
           Version: unspecified
          Platform: PC
        OS/Version: Linux
            Status: NEW
          Severity: enhancement
          Priority: P
         Component: C++
        AssignedTo: unassignedclangbugs at nondot.org
        ReportedBy: nicholas at mxc.ca
                CC: dgregor at apple.com, llvmbugs at cs.uiuc.edu
    Classification: Unclassified


I would like a couple new warnings. Testcase:

  class Cls {};
  int foo(Cls &obj) {
    if (&obj == 0) return 0;
    return 1;
  }
  void bar() {
    foo(*(Cls*)0);
  }

First of all, this was found in the wild, actually in clang/Stmt.h and reported
on IRC. There's a null dereference in an attempt to form a null reference
argument in bar. That should produce a warning. Secondly the callee has a check
for whether the reference argument is a null. That should produce another
warning.

-- 
Configure bugmail: http://llvm.org/bugs/userprefs.cgi?tab=email
------- You are receiving this mail because: -------
You are on the CC list for the bug.



More information about the llvm-bugs mailing list