<html>
    <head>
      <base href="https://llvm.org/bugs/" />
    </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 --- - Cast to typedef __attribute__((aligned(N))) pointer doesn't respect the requested alignment anymore."
   href="https://llvm.org/bugs/show_bug.cgi?id=24944">24944</a>
          </td>
        </tr>

        <tr>
          <th>Summary</th>
          <td>Cast to typedef __attribute__((aligned(N))) pointer doesn't respect the requested alignment anymore.
          </td>
        </tr>

        <tr>
          <th>Product</th>
          <td>clang
          </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>-New Bugs
          </td>
        </tr>

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

        <tr>
          <th>Reporter</th>
          <td>ahmed.bougacha@gmail.com
          </td>
        </tr>

        <tr>
          <th>CC</th>
          <td>llvm-bugs@lists.llvm.org
          </td>
        </tr>

        <tr>
          <th>Classification</th>
          <td>Unclassified
          </td>
        </tr></table>
      <p>
        <div>
        <pre>typedef int __attribute__((ext_vector_type(4))) v4i32;
typedef v4i32 __attribute__((aligned(2))) v4i32_a2;

v4i32 l1(v4i32 *p) {
  v4i32_a2 *p2 = p;
  return *p2;
}

v4i32 l2(v4i32 *p) {
  return *(v4i32_a2*)p;
}


This used to generate:


define <4 x i32> @l1(<4 x i32>* nocapture readonly %p) #0 {
  %1 = load <4 x i32>* %p, align 2, !tbaa !2
  ret <4 x i32> %1
}

; Function Attrs: nounwind readonly ssp uwtable
define <4 x i32> @l2(<4 x i32>* nocapture readonly %p) #0 {
  %1 = load <4 x i32>* %p, align 2, !tbaa !2
  ret <4 x i32> %1
}


but now generates:


target datalayout = "e-m:o-i64:64-f80:128-n8:16:32:64-S128"
target triple = "x86_64-apple-macosx10.11.0"

; Function Attrs: nounwind readonly ssp uwtable
define <4 x i32> @l1(<4 x i32>* nocapture readonly %p) #0 {
entry:
  %0 = load <4 x i32>, <4 x i32>* %p, align 2, !tbaa !2
  ret <4 x i32> %0
}

; Function Attrs: nounwind readonly ssp uwtable
define <4 x i32> @l2(<4 x i32>* nocapture readonly %p) #0 {
entry:
  %0 = load <4 x i32>, <4 x i32>* %p, align 16, !tbaa !2   ;; <- why not align
2?
  ret <4 x i32> %0
}</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>