[llvm-bugs] [Bug 48903] New: Wrong size of struct with aligned bitfield

via llvm-bugs llvm-bugs at lists.llvm.org
Wed Jan 27 10:36:30 PST 2021


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

            Bug ID: 48903
           Summary: Wrong size of struct with aligned bitfield
           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

#pragma pack(1)

struct X {
        char c:1;
        __attribute__((aligned(2))) char d:1;
        __attribute__((aligned(2))) char e:1;
};

int f(void) {
        return sizeof(struct X);
}

gcc returns 3, clang returns 1 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/20210127/0cf20a9d/attachment-0001.html>


More information about the llvm-bugs mailing list