<table border="1" cellspacing="0" cellpadding="8">
    <tr>
        <th>Issue</th>
        <td>
            <a href=https://github.com/llvm/llvm-project/issues/89341>89341</a>
        </td>
    </tr>

    <tr>
        <th>Summary</th>
        <td>
            [x86] segmentation fault of movaps instruction when a pointer(aligned) is directly assigned
        </td>
    </tr>

    <tr>
      <th>Labels</th>
      <td>
            new issue
      </td>
    </tr>

    <tr>
      <th>Assignees</th>
      <td>
      </td>
    </tr>

    <tr>
      <th>Reporter</th>
      <td>
          Jolyon0202
      </td>
    </tr>
</table>

<pre>
    Here the struct AlignedStruct's size is 68 bytes, but alignment is 64.
AlignedStruct elements is close packing, then the address of g[1] is not 64 bytes alignment. But  clang emit movaps instruction because of the alignment attribute.  Is this code  design problem or the problem of clang emitting movaps(the p is maybe direct assigned)?

ps: gcc does not  emit movaps here, 

```
#include <iostream>
#include <stdlib.h>

#pragma pack(1)

typedef struct AlignedStructNode {
   AlignedStructNode *a;
 AlignedStructNode *b;
   AlignedStructNode *c;
   uint32_t d;
 char f[40];
}AlignedStruct __attribute__((aligned(64)));
#pragma pack()

int main() {
    AlignedStruct alignedData;
 AlignedStruct* g = (AlignedStruct *)malloc(10 * sizeof(AlignedStruct));
 AlignedStruct* p = &(g[2]);

    p->a = nullptr;
    p->b = nullptr;
    p->c = nullptr;

    std::cout << "Size of alignedData: " << sizeof(alignedData) << std::endl;
    std::cout << "Address of alignedData: " << &alignedData << std::endl;
    std::cout << "&g[0] = " << &(g[0]) << std::endl;
    std::cout << "&g[1] = " << &(g[1]) << std::endl;
    std::cout << "&g[2] = " << &(g[2]) << std::endl;
    return 0;
}
```
clang++  f.cpp  -O2  && ./a.out
segmentation fault

</pre>
<img width="1px" height="1px" alt="" src="http://email.email.llvm.org/o/eJysVV2PqzYQ_TWTl9EiMB8hDzyQzY3aPrQP9wdEBg_g1mBkm3ub_vrKwCZkb3ZVtZVQInzO-HjOmBlurWwHogLSI6SnHZ9cp03xi1ZXPYQsZLtKi2vxExlC1xFaZ6baYal8lP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