This is the mail archive of the
gcc-help@gcc.gnu.org
mailing list for the GCC project.
Is UBSan supposed to produce a finding for _mm_load_sd and _mm_store_sd
- From: Jeffrey Walton <noloader at gmail dot com>
- To: "gcc-help at gcc dot gnu dot org" <gcc-help at gcc dot gnu dot org>
- Date: Fri, 8 Dec 2017 12:15:59 -0500
- Subject: Is UBSan supposed to produce a finding for _mm_load_sd and _mm_store_sd
- Authentication-results: sourceware.org; auth=none
- Reply-to: noloader at gmail dot com
I have some code that loads a 64-bit integer into a XMM register. It
loads the integer from a byte array:
byte v[8] = ...
__m128i t = _mm_castpd_si128(
_mm_load_sd((const double *)(v)));
It is producing a finding for an unaligned load. I get similar
findings for _mm_load_sd, _mm_store_sd and _mm_loaddup_pd.
According to the Intel Intrinsics Guide (e.g., _mm_load_sd):
Load a double-precision (64-bit) floating-point element from memory
into the lower of dst, and zero the upper element. mem_addr does
not need to be aligned on any particular boundary.
Should GCC be producing a finding in this case? Is there a way to work
around it without an extra memcpy?
A similar Clang issue is at http://bugs.llvm.org/show_bug.cgi?id=20670 .
Thanks in advance,
Jeff