<html>
    <head>
      <base href="https://bugs.llvm.org/">
    </head>
    <body><table border="1" cellspacing="0" cellpadding="8">
        <tr>
          <th>Bug ID</th>
          <td><a class="bz_bug_link 
          bz_status_NEW "
   title="NEW - [DWARF] DW_AT_alignment incorrect when attribute((__aligned__)) is present but ignored"
   href="https://bugs.llvm.org/show_bug.cgi?id=51277">51277</a>
          </td>
        </tr>

        <tr>
          <th>Summary</th>
          <td>[DWARF] DW_AT_alignment incorrect when attribute((__aligned__)) is present but ignored
          </td>
        </tr>

        <tr>
          <th>Product</th>
          <td>clang
          </td>
        </tr>

        <tr>
          <th>Version</th>
          <td>trunk
          </td>
        </tr>

        <tr>
          <th>Hardware</th>
          <td>PC
          </td>
        </tr>

        <tr>
          <th>OS</th>
          <td>Windows NT
          </td>
        </tr>

        <tr>
          <th>Status</th>
          <td>NEW
          </td>
        </tr>

        <tr>
          <th>Severity</th>
          <td>normal
          </td>
        </tr>

        <tr>
          <th>Priority</th>
          <td>P
          </td>
        </tr>

        <tr>
          <th>Component</th>
          <td>C++
          </td>
        </tr>

        <tr>
          <th>Assignee</th>
          <td>unassignedclangbugs@nondot.org
          </td>
        </tr>

        <tr>
          <th>Reporter</th>
          <td>Wolfgang_Pieb@playstation.sony.com
          </td>
        </tr>

        <tr>
          <th>CC</th>
          <td>blitzrakete@gmail.com, dgregor@apple.com, erik.pilkington@gmail.com, llvm-bugs@lists.llvm.org, richard-llvm@metafoo.co.uk
          </td>
        </tr></table>
      <p>
        <div>
        <pre>// 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 
<a href="https://gcc.gnu.org/onlinedocs/gcc-11.2.0/gcc/Common-Type-Attributes.html#Common-Type-Attributes">https://gcc.gnu.org/onlinedocs/gcc-11.2.0/gcc/Common-Type-Attributes.html#Common-Type-Attributes</a>.

g++ generates a type DIE for MyType with DW_AT_alignment being 4.</pre>
        </div>
      </p>


      <hr>
      <span>You are receiving this mail because:</span>

      <ul>
          <li>You are on the CC list for the bug.</li>
      </ul>
    </body>
</html>