[llvm-bugs] [Bug 42292] New: -Wnull-dereference warns about pointers with address_space attribute

via llvm-bugs llvm-bugs at lists.llvm.org
Sun Jun 16 13:20:13 PDT 2019


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: unassignedclangbugs at nondot.org
          Reporter: tijl at coosemans.org
                CC: htmldeveloper at gmail.com, llvm-bugs at lists.llvm.org,
                    neeilans at live.com, richard-llvm at metafoo.co.uk

% 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.
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.llvm.org/pipermail/llvm-bugs/attachments/20190616/f6e46e7d/attachment.html>


More information about the llvm-bugs mailing list