[LLVMbugs] [Bug 13956] New: Clang doesn't emit tautological-compare warning when nonnull is compared against NULL

bugzilla-daemon at llvm.org bugzilla-daemon at llvm.org
Thu Sep 27 11:58:29 PDT 2012


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

             Bug #: 13956
           Summary: Clang doesn't emit tautological-compare warning when
                    nonnull is compared against NULL
           Product: clang
           Version: trunk
          Platform: All
        OS/Version: All
            Status: NEW
          Severity: enhancement
          Priority: P
         Component: Frontend
        AssignedTo: unassignedclangbugs at nondot.org
        ReportedBy: htam at apple.com
                CC: llvmbugs at cs.uiuc.edu
    Classification: Unclassified


This code:

__attribute__((nonnull(1))) int foo(int* x) {
    return x == NULL;
}

should emit a tautological comparison warning.  This was found in the wild when
a function had an off-by-one error in the nonnull attribute parameter, leading
to bad DCE.

I am running at r164778.

-- 
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