https://gcc.gnu.org/bugzilla/show_bug.cgi?id=122692

--- Comment #2 from John Platts <john_platts at hotmail dot com> ---
Turns out that the bug is triggered by this loop (which has been separated out
into a function with the __attribute__((__noinline__)) and
__attribute__((__noinline__)) attributes):
static __attribute__((__noinline__)) NOIPA_ATTR void GenerateRandomU16x16Vals(
    RandomState& rng, uint16_t* const from, uint8_t* const expected) {
  using T = uint16_t;
  using TN = uint8_t;

  const T min = 0;
  const T max = static_cast<T>(std::numeric_limits<TN>::max());

  for (size_t i = 0; i < 16; ++i) {
    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));
  }
}

Reply via email to