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

            Bug ID: 51277
           Summary: [DWARF] DW_AT_alignment incorrect when
                    attribute((__aligned__)) is present but ignored
           Product: clang
           Version: trunk
          Hardware: PC
                OS: Windows NT
            Status: NEW
          Severity: normal
          Priority: P
         Component: C++
          Assignee: unassignedclangb...@nondot.org
          Reporter: wolfgang_p...@playstation.sony.com
                CC: blitzrak...@gmail.com, dgre...@apple.com,
                    erik.pilking...@gmail.com, llvm-bugs@lists.llvm.org,
                    richard-l...@metafoo.co.uk

// Given the following source,

struct MyType { int m; } __attribute__((aligned(1)));
MyType mt;

when simply compiled with clang++ -c -g, produces a DW_TAG_structure_type DIE
for MyType, with DW_AT_alignment having a value of 1.

However, the actual alignment of the type is 4, since, according to the gcc
documentation, the alignment attribute, when used on structs, can only increase
alignment, and not decrease it (unless attribute "packed" is also specified).
clang does return the correct value from alignof(). See 
https://gcc.gnu.org/onlinedocs/gcc-11.2.0/gcc/Common-Type-Attributes.html#Common-Type-Attributes.

g++ generates a type DIE for MyType with DW_AT_alignment being 4.

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

Reply via email to