This is the mail archive of the
gcc-bugs@gcc.gnu.org
mailing list for the GCC project.
[Bug sanitizer/84508] Load of misaligned address using _mm_load_sd
- From: "jakub at gcc dot gnu.org" <gcc-bugzilla at gcc dot gnu dot org>
- To: gcc-bugs at gcc dot gnu dot org
- Date: Thu, 22 Feb 2018 09:33:21 +0000
- Subject: [Bug sanitizer/84508] Load of misaligned address using _mm_load_sd
- Auto-submitted: auto-generated
- References: <bug-84508-4@http.gcc.gnu.org/bugzilla/>
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.