[llvm-bugs] [Bug 45656] Wrong alignment of load instruction when load vector cast from other pointer

via llvm-bugs llvm-bugs at lists.llvm.org
Fri Apr 24 00:30:48 PDT 2020


https://bugs.llvm.org/show_bug.cgi?id=45656

Roman Lebedev <lebedev.ri at gmail.com> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
         Resolution|---                         |INVALID
                 CC|                            |lebedev.ri at gmail.com
             Status|NEW                         |RESOLVED

--- Comment #1 from Roman Lebedev <lebedev.ri at gmail.com> ---
(In reply to JunMa from comment #0)
> see testcase in https://godbolt.org/z/Fz3vG4 we cast void* ptr to v8si*, and
> then read it. 
> 
> It seems clang generates the load instruction with alignment of vector type,
> not the element type which is wrong.
> 
> when we build with march=core-avx2, llvm emits vmovdqa which may cause seg
> fault when ptr is not 32byte align.

Yep, and that is UB.
You may want to specify that the type is underaligned,
e.g. https://godbolt.org/z/8kC6rt

-- 
You are receiving this mail because:
You are on the CC list for the bug.
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.llvm.org/pipermail/llvm-bugs/attachments/20200424/54c5e2a4/attachment.html>


More information about the llvm-bugs mailing list