<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 - Alignment specifier not applied to anonymous structure or union"
   href="https://bugs.llvm.org/show_bug.cgi?id=43983">43983</a>
          </td>
        </tr>

        <tr>
          <th>Summary</th>
          <td>Alignment specifier not applied to anonymous structure or union
          </td>
        </tr>

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

        <tr>
          <th>Version</th>
          <td>9.0
          </td>
        </tr>

        <tr>
          <th>Hardware</th>
          <td>Macintosh
          </td>
        </tr>

        <tr>
          <th>OS</th>
          <td>MacOS X
          </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>omrimor2@illinois.edu
          </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>Created <span class=""><a href="attachment.cgi?id=22802" name="attach_22802" title="minimal example">attachment 22802</a> <a href="attachment.cgi?id=22802&action=edit" title="minimal example">[details]</a></span>
minimal example

The _Alignas specifier is not being applied to anonymous structures or unions.
If the structure or union is given a declarator then the alignment specifier is
correctly applied. This is a useful construct in that it allows for alignment
of portions of a structure.

#include <stdio.h>

struct A {              struct { int a; };   };
struct B { _Alignas(64) struct { int b; };   };
struct C { _Alignas(64) struct { int c; } x; };

int main(int argc, char *argv[])
{
        printf("%zu %zu %zu\n",
               sizeof(struct A), sizeof(struct B), sizeof(struct C));
        return 0;
}

Should output "4 64 64" on an LP64 platform; instead outputs "4 4 64". GCC 9
compiles correctly. I haven't yet tested on platforms other than macOS.</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>