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

Matthias Kretz (Vir) <mkretz at gcc dot gnu.org> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
           Assignee|unassigned at gcc dot gnu.org      |mkretz at gcc dot 
gnu.org

--- Comment #2 from Matthias Kretz (Vir) <mkretz at gcc dot gnu.org> ---
This specific failure is testing complex multiplication. It fails at

simd::vec<complex<float>, 2> x = {-inf, -nan};
verify_equal(x * x, x[0] * x[0]);

'x * x' has the value {nan, -nan} for both elements.

'x[0] * x[0]' has the value {inf, -nan}.

constexpr evaluation of std::complex multiplication yields {inf, nan}.

According to C Annex G:
- "A complex […] value with at least one infinite part is regarded as an
infinity (even if its other part is a quiet NaN)."
- "if one operand is an infinity and the other operand is […] an infinity, then
the result of the * operator is an infinity;"

The 'x * x' result is not an infinity. But the test passes on x86_64-linux-gnu.

As is visible here (https://compiler-explorer.com/z/5hPYf5154), the
implementation first does a straightforward complex-complex multiplication. If
that produces a NaN in any of the resulting scalar elements the multiplication
is re-evaluated using the std::complex multiplication operator for those
elements that produced a NaN.

That's where I'm stuck. I have no idea how this failure can happen without
disassembling/debugging the failing test binary. Is there any way that I can
try to reproduce this?

Reply via email to