https://gcc.gnu.org/bugzilla/show_bug.cgi?id=127093
Bug ID: 127093
Summary: [17 Regression] ranger vs FENV_ACCESS
Product: gcc
Version: 17.0
Status: UNCONFIRMED
Keywords: wrong-code
Severity: normal
Priority: P3
Component: tree-optimization
Assignee: unassigned at gcc dot gnu.org
Reporter: ktkachov at gcc dot gnu.org
Target Milestone: ---
Target: aarch64
#pragma STDC FENV_ACCESS ON
#include <float.h>
#include <fenv.h>
#include <math.h>
#include <stdlib.h>
int
f (int c)
{
double x = c ? DBL_MAX : -DBL_MAX;
double y = x * 2.0;
return fabs (y) == INFINITY;
}
int
main (void)
{
volatile int c = 1;
feclearexcept (FE_ALL_EXCEPT);
if (f (c) != 1 || !fetestexcept (FE_OVERFLOW))
abort ();
c = 0;
feclearexcept (FE_ALL_EXCEPT);
if (f (c) != 1 || !fetestexcept (FE_OVERFLOW))
abort ();
return 0;
}
on aarch64 at -O2 this aborts and passes at -O0