https://gcc.gnu.org/bugzilla/show_bug.cgi?id=102224
Martin Liška <marxin at gcc dot gnu.org> changed:
What |Removed |Added
----------------------------------------------------------------------------
Summary|[9/10/11/12 regession] |[9/10/11/12 regession]
|wrong code for `x * |wrong code for `x *
|copysign(1.0, x)` |copysign(1.0, x)` since
| |r9-5298-g33142cf9cf82aa1f
CC| |hjl at gcc dot gnu.org,
| |marxin at gcc dot gnu.org
--- Comment #9 from Martin Liška <marxin at gcc dot gnu.org> ---
(In reply to Gabriel Ravier from comment #5)
> Actually it seems to me like this is a GCC 9 regression, ever since this
> pattern exists: GCC 9, 10 and 11 emit the exact same faulty code.
I can confirm that:
$ cat pr102224.c
float
__attribute__((noipa))
f(float x, float y)
{
return x * __builtin_copysignf(1.0f, x);
}
int main()
{
float a = 1.23f;
volatile float b = f(a, a);
__builtin_printf ("a: %.2f, b: %.2f\n", a, b);
if (b != a)
__builtin_abort ();
return 0;
}
$ gcc pr102224.c -g -O3 && ./a.out
a: 1.23, b: 0.00
Aborted (core dumped)
Started with r9-5298-g33142cf9cf82aa1f.