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: [email protected]
        ReportedBy: [email protected]
                CC: [email protected], [email protected]
    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.
_______________________________________________
LLVMbugs mailing list
[email protected]
http://lists.cs.uiuc.edu/mailman/listinfo/llvmbugs

Reply via email to