[llvm-bugs] [Bug 42568] New: Attribute 'noderef' fails to warn in some cases

via llvm-bugs llvm-bugs at lists.llvm.org
Wed Jul 10 11:25:27 PDT 2019


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

            Bug ID: 42568
           Summary: Attribute 'noderef' fails to warn in some cases
           Product: clang
           Version: unspecified
          Hardware: PC
                OS: Windows NT
            Status: NEW
          Severity: enhancement
          Priority: P
         Component: Frontend
          Assignee: unassignedclangbugs at nondot.org
          Reporter: paul_robinson at playstation.sony.com
                CC: llvm-bugs at lists.llvm.org, neeilans at live.com,
                    richard-llvm at metafoo.co.uk

C:\TMP>type test.c
struct S {
  int x;
};

struct S __attribute__((noderef)) *s;

void bar() {
  struct S *p = s;  // warned
  int *q = &s->x;   // not warned
  int *r = &(*s).x; // not warned
}

C:\TMP>clang -c test.c
test.c:8:17: warning: casting to dereferenceable pointer removes 'noderef'
      attribute [-Wnoderef]
  struct S *p = s;  // warned
                ^
1 warning generated.

-- 
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/20190710/70c9f1da/attachment.html>


More information about the llvm-bugs mailing list