https://gcc.gnu.org/bugzilla/show_bug.cgi?id=126016
Bug ID: 126016
Summary: -frounding-math does not prevent removal of casts
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: pinskia at gcc dot gnu.org
Target Milestone: ---
```
float fdf(float a)
{
double b = a;
return b;
}
```
With -frounding-math this should prevent the removal of the widdening and
truncation cast because it could cause different answer.
The same is true with __builtin_fabs and __builtin_copysign:
```
float fdabsf(float a)
{
double b = a;
return __builtin_fabs(b); // does the right thing already
}
float fdcopyf(float a, float s)
{
double b = a;
double c = s;
return __builtin_copysign(b, c);
}
```