[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


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

           Summary: Incorrect warning about non-volatile NULL pointer
                    dereference
           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


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

int main() {
  A(0);
  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]
  A(0);
  ^~~~
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
'volatile'
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