[llvm-bugs] [Bug 49086] New: Wrong offset of bit-field with explicit alignment

via llvm-bugs llvm-bugs at lists.llvm.org
Sun Feb 7 21:06:54 PST 2021


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

            Bug ID: 49086
           Summary: Wrong offset of bit-field with explicit alignment
           Product: clang
           Version: 11.0
          Hardware: PC
                OS: Linux
            Status: NEW
          Severity: enhancement
          Priority: P
         Component: C
          Assignee: unassignedclangbugs at nondot.org
          Reporter: ju.orth at gmail.com
                CC: blitzrakete at gmail.com, dgregor at apple.com,
                    erik.pilkington at gmail.com, llvm-bugs at lists.llvm.org,
                    richard-llvm at metafoo.co.uk

Consider

struct A {
    char c;
    long l:56 __attribute__((aligned(2)));
    char d;
};

int f(void) {
    return __builtin_offsetof(struct A, d);
}

GCC returns 15, Clang returns 9 on the x86_64-unknown-linux-gnu target.

-- 
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/20210208/f1e73b8d/attachment.html>


More information about the llvm-bugs mailing list