https://gcc.gnu.org/bugzilla/show_bug.cgi?id=122692
--- Comment #3 from John Platts <john_platts at hotmail dot com> --- Found a GCC 15 bug on the RISC-V target where the store of the lower 16 bits of bits to from[i] followed by a reload of from[i] is incorrectly optimized out from a reduced snippet at https://godbolt.org/z/ndY8G8Wcx. Here is the snippet having a bug with GCC 15.2 on riscv64: const uint64_t bits = rng(); __builtin_memcpy(&from[i], &bits, sizeof(T)); // not same size expected[i] = static_cast<TN>(HWY_MIN(HWY_MAX(min, from[i]), max)); The problem is that GCC 15 fails to zero out the upper 48 bits of from[i] before doing the comparison (as demonstrated by the snippet at https://godbolt.org/z/ndY8G8Wcx), producing incorrect results for expected[i]. This same bug does not occur with GCC 14.3 or Clang 21 on riscv64, and both GCC 14.3 and Clang 21 correctly zero out the upper 48 bits of from[i] before doing the comparison against 255.
