[LLVMbugs] [Bug 8876] New: Incorrect warning about non-volatile NULL pointer dereference

bugzilla-daemon at llvm.org bugzilla-daemon at llvm.org
Thu Dec 30 16:55:09 PST 2010


           Summary: Incorrect warning about non-volatile NULL pointer
           Product: clang
           Version: trunk
          Platform: PC
        OS/Version: Linux
            Status: NEW
          Severity: normal
          Priority: P
         Component: -New Bugs
        AssignedTo: unassignedclangbugs at nondot.org
        ReportedBy: jed at 59a2.org
                CC: llvmbugs at cs.uiuc.edu

#define A(err_ptr) do {                         \
    if (err_ptr) *(int*)(err_ptr) = 1;          \
  } while (0)

int main() {
  return 0;

The macro `A()` was reduced from a larger mutex-managing macro.

$ clang null.c
null.c:6:3: warning: indirection of non-volatile null pointer will be deleted,
not trap [-Wnull-dereference]
null.c:2:18: note: instantiated from:
    if (err_ptr) *(int*)(err_ptr) = 1;          \
null.c:6:3: note: consider using __builtin_trap() or qualifying pointer with
1 warning generated.

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