[Bug middle-end/123826] folding of `pow(a, 2.0)` into a*a causes errno not to be set
pinskia at gcc dot gnu.org
gcc-bugzilla@gcc.gnu.org
Wed Feb 25 05:59:49 GMT 2026
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=123826
--- Comment #11 from Andrew Pinski <pinskia at gcc dot gnu.org> ---
(In reply to Hongtao Liu from comment #10)
>
> Yes, original code is std::pow (a, 2).
>
> And I notice std::pow (a, -1) is still optimized to divsd, should it also be
> prevented?
Yes unless you know that a is nonzero.
```
If base is zero and exponent is negative, a domain error or a pole error may
occur.
```
More information about the Gcc-bugs
mailing list