[Bug sanitizer/84508] Load of misaligned address using _mm_load_sd
jakub at gcc dot gnu.org
gcc-bugzilla@gcc.gnu.org
Thu Feb 22 09:34:00 GMT 2018
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=84508
--- Comment #4 from Jakub Jelinek <jakub at gcc dot gnu.org> ---
I don't see how this is related to sanitizer, sanitizer just checks what it
sees.
Say _mm_load_sd is implemented as
/* Create a vector with element 0 as *P and the rest zero. */
extern __inline __m128d __attribute__((__gnu_inline__, __always_inline__,
__artificial__))
_mm_load_sd (double const *__P)
{
return _mm_set_sd (*__P);
}
and so pedantically requires aligned load, it is like any other double *
dereference.
If these intrinsics really allow misaligned loads, then we need to use
something different, not sure if e.g.
struct S __attribute__((packed)) { double d; } const *p = (struct S const *)
(void *) __P;
return _mm_set_sd (p->d);
would be ok from aliasing POV or if we'd need to introduce a builtin to load a
potentially misaligned float or double. I guess the most important would be
that it doesn't slow down code.
More information about the Gcc-bugs
mailing list