[Bug c/81389] _mm_cmpestri segfault on -O0

jakub at gcc dot gnu.org gcc-bugzilla@gcc.gnu.org
Wed Aug 30 03:37:00 GMT 2017


https://gcc.gnu.org/bugzilla/show_bug.cgi?id=81389

Jakub Jelinek <jakub at gcc dot gnu.org> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
             Status|REOPENED                    |RESOLVED
         Resolution|---                         |INVALID

--- Comment #14 from Jakub Jelinek <jakub at gcc dot gnu.org> ---
(In reply to rockeet from comment #11)
> @H.J. Lu
> 
> Have you tried your `solution`?
> 
> `_mm_cmpestri` is a C function and have no overloaded with type `__m128i_u`.

Why would it need that?  __m128i_u is convertible to __m128i, just do what H.J.
posted.  Doing *(const __m128i*)(ptr+3) is UB at runtime if ptr mod 16 isn't
13, it doesn't matter what function you pass it into.  And at -O1 GCC is able
to merge the memory load with the pcmpestri instruction in this case, if you
care about code quality, don't use -O0.

There is no bug on the GCC side.


More information about the Gcc-bugs mailing list