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

            Bug ID: 48777
           Summary: Wrong alignment of nested __declspec(align)s
           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 I1;

__declspec(align(1)) typedef I1 I2;

struct X {
        I2 i;
};

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

msvc returns 8, clang returns 4 on the target x86_64-pc-windows-msvc. The
problem is that [1] ignores all typedefs and [2] only considers the outermost
typedef.

[1]
https://github.com/llvm/llvm-project/blob/a048ce13e32daa255d26533c00da8abd0b67e819/clang/lib/AST/RecordLayoutBuilder.cpp#L2586-L2587

[2]
https://github.com/llvm/llvm-project/blob/a048ce13e32daa255d26533c00da8abd0b67e819/clang/lib/AST/RecordLayoutBuilder.cpp#L2593-L2595

-- 
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