Issue 145156
Summary UBSan: Incorrect _mm_storeh_pd alignment requirement
Labels new issue
Assignees
Reporter justus2510
    As far as I understand, _mm_storeh_pd does not have any alignment requirements, similar to _mm_storel_epi64. However, currently UBSan will complain about unaligned pointers:

```
#include <immintrin.h>

int main()
{
    unsigned char buf[64];
 _mm_storeh_pd((double *)(buf + 1), _mm_set1_pd(3.14));
}
```
```
/opt/compiler-explorer/gcc-15.1.0/lib/gcc/x86_64-linux-gnu/15.1.0/include/emmintrin.h:203:8: runtime error: store to misaligned address 0x7ffe97c63371 for type 'double', which requires 8 byte alignment
0x7ffe97c63371: note: pointer points here
 1e 09 40  00 00 00 00 00 00 00 00  00 00 00 00 00 00 00 00  00 00 00 00 00 00 00 00  00 00 00 00 00
              ^ 
```

The code runs fine, and the Intel documentation does not mention any alignment requirements either.
_______________________________________________
llvm-bugs mailing list
llvm-bugs@lists.llvm.org
https://lists.llvm.org/cgi-bin/mailman/listinfo/llvm-bugs

Reply via email to