On 2025-01-16 11:29, Bruno Haible via Gnulib discussion list wrote:
../lib/crc-x86_64-pclmul.c:120:26: runtime error: load of misaligned address 
0x5572a8d5f161 for type 'const __m128i *', which requires 16 byte alignment
0x5572a8d5f161: note: pointer points here
  2a 27 00  fc 75 47 2e 58 58 bf 5a  d1 0f bb b4 48 98 72 83  ab e2 e8 b8 72 44 
6d 71  24 02 1a 7a d2
               ^
SUMMARY: UndefinedBehaviorSanitizer: undefined-behavior 
../lib/crc-x86_64-pclmul.c:120:26

I puzzled because the source code line is:

      memcpy (final_buf, data, bytes_remaining);

and memcpy is supposed to work on unaligned data. Is it that clang assumes that, since final_buf and data are both pointers to __m128i, clang can use instructions that require (instead of prefer) 16-byte alignment?

That being said, it does appear there are a lot of unaligned word accesses nearby, which can't be good for performance even if the hardware doesn't trap. Sam, is that intended?

Reply via email to