https://bugs.llvm.org/show_bug.cgi?id=42292

            Bug ID: 42292
           Summary: -Wnull-dereference warns about pointers with
                    address_space attribute
           Product: clang
           Version: 8.0
          Hardware: PC
                OS: FreeBSD
            Status: NEW
          Severity: enhancement
          Priority: P
         Component: -New Bugs
          Assignee: [email protected]
          Reporter: [email protected]
                CC: [email protected], [email protected],
                    [email protected], [email protected]

% cat test.c
int f(void) {                 
    return *(int __attribute__((address_space(256))) *) 0;
}
% clang80 -S test.c
test.c:2:12: warning: indirection of non-volatile null pointer will be deleted,
      not trap [-Wnull-dereference]
    return *(int __attribute__((address_space(256))) *) 0;
           ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
test.c:2:12: note: consider using __builtin_trap() or qualifying pointer with
      'volatile'
1 warning generated.

This warning seems incorrect for pointers with address_space attribute.  Clang
also doesn't delete the dereference.  It correctly produces "movl %gs:0, %eax".

-- 
You are receiving this mail because:
You are on the CC list for the bug.
_______________________________________________
llvm-bugs mailing list
[email protected]
https://lists.llvm.org/cgi-bin/mailman/listinfo/llvm-bugs

Reply via email to