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

            Bug ID: 48787
           Summary: Wrong size of arrays with over-aligned elements
           Product: clang
           Version: 11.0
          Hardware: PC
                OS: Linux
            Status: NEW
          Severity: enhancement
          Priority: P
         Component: C
          Assignee: [email protected]
          Reporter: [email protected]
                CC: [email protected], [email protected],
                    [email protected], [email protected],
                    [email protected]

Consider

__declspec(align(8)) typedef int Int[3];

struct Y {
    Int y[3];
    int i;
};

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

msvc returns 40, clang returns 48 for the x86_64-pc-windows-msvc target.
Presumably because [1] rounds up the size to the alignment.

[1]
https://github.com/llvm/llvm-project/blob/689aaba7acf5778bfe96bfd7bc4f1f3ceed20dc8/clang/lib/AST/ASTContext.cpp#L1926-L1928

-- 
You are receiving this mail because:
You are on the CC list for the bug.
_______________________________________________
llvm-bugs mailing list
[email protected]
https://lists.llvm.org/cgi-bin/mailman/listinfo/llvm-bugs

Reply via email to