<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 not respected in containers for over-aligned enumeration types"
   href="https://bugs.llvm.org/show_bug.cgi?id=42396">42396</a>
          </td>
        </tr>

        <tr>
          <th>Summary</th>
          <td>Alignment not respected in containers for over-aligned enumeration types
          </td>
        </tr>

        <tr>
          <th>Product</th>
          <td>libc++
          </td>
        </tr>

        <tr>
          <th>Version</th>
          <td>unspecified
          </td>
        </tr>

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

        <tr>
          <th>OS</th>
          <td>All
          </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>All Bugs
          </td>
        </tr>

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

        <tr>
          <th>Reporter</th>
          <td>mclow.lists@gmail.com
          </td>
        </tr>

        <tr>
          <th>CC</th>
          <td>llvm-bugs@lists.llvm.org, mclow.lists@gmail.com
          </td>
        </tr></table>
      <p>
        <div>
        <pre>Created <span class=""><a href="attachment.cgi?id=22140" name="attach_22140" title="Reproducer">attachment 22140</a> <a href="attachment.cgi?id=22140&action=edit" title="Reproducer">[details]</a></span>
Reproducer

Inspired by:
<a href="https://stackoverflow.com/questions/56760874/discrepancy-in-c-between-over-aligned-struct-and-enum-within-container">https://stackoverflow.com/questions/56760874/discrepancy-in-c-between-over-aligned-struct-and-enum-within-container</a>

Given an enumeration type with a specified alignment, the elements in a vector
of such a type should be aligned correctly. This appears not to be the case -
and can lead to UBSAN going off.


In the reproducer, I also check the size of a 16-element array of these two
types.
Clang says they're different sizes - that suggests to me that there's a clang
problem here. 

The alignment in the containers bit could be related to
<a class="bz_bug_link 
          bz_status_CONFIRMED "
   title="CONFIRMED - operator new and STL containers silently ignore element alignment"
   href="show_bug.cgi?id=22634">https://bugs.llvm.org/show_bug.cgi?id=22634</a>. (might even be the same bug)</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>