[llvm-bugs] [Bug 51277] New: [DWARF] DW_AT_alignment incorrect when attribute((__aligned__)) is present but ignored

via llvm-bugs llvm-bugs at lists.llvm.org
Thu Jul 29 16:09:58 PDT 2021


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: unassignedclangbugs at nondot.org
          Reporter: Wolfgang_Pieb at playstation.sony.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

// 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.
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.llvm.org/pipermail/llvm-bugs/attachments/20210729/c9fecb2e/attachment.html>


More information about the llvm-bugs mailing list