[llvm-bugs] [Bug 42862] New: -Waddress-of-packed member should not trigger inside typeof/decltype/sizeof

via llvm-bugs llvm-bugs at lists.llvm.org
Thu Aug 1 07:15:59 PDT 2019


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

            Bug ID: 42862
           Summary: -Waddress-of-packed member should not trigger inside
                    typeof/decltype/sizeof
           Product: clang
           Version: trunk
          Hardware: PC
                OS: All
            Status: NEW
          Severity: enhancement
          Priority: P
         Component: Frontend
          Assignee: unassignedclangbugs at nondot.org
          Reporter: arichardson.kde at gmail.com
                CC: llvm-bugs at lists.llvm.org, neeilans at live.com,
                    richard-llvm at metafoo.co.uk

I noticed that -Waddress-of-packed member triggers inside a typeof expression:

struct foo {
    char c;
    int member;
} __attribute__((packed));


int* good(struct foo* f) {
    __typeof__(&(f->member)) ptr = 0;
    return ptr;
}

int* bad(struct foo* f) {
    return &f->member;
}



GCC compiles this code fine and only complains when actually taking the
address.
Example: https://godbolt.org/z/XMrchk

-- 
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/20190801/99c07a7b/attachment.html>


More information about the llvm-bugs mailing list