https://gcc.gnu.org/bugzilla/show_bug.cgi?id=123826
Bug ID: 123826
Summary: folding of `pow(a, 2.0)` into a*a causes errno not to
be set
Product: gcc
Version: 16.0
Status: UNCONFIRMED
Keywords: wrong-code
Severity: normal
Priority: P3
Component: middle-end
Assignee: unassigned at gcc dot gnu.org
Reporter: pinskia at gcc dot gnu.org
Target Milestone: ---
Created attachment 63490
--> https://gcc.gnu.org/bugzilla/attachment.cgi?id=63490&action=edit
testcase
From:
https://mastodon.social/@dotstdy/115960430921170421
https://godbolt.org/z/xahMha3zY
Take the attached testcase.
GCC will simplify `pow(a, 2.0)` at -O2 into a*a and constant fold
`pow(DBL_MAX, 2.0)` (in general). This means we lose the errno setting.
Note changing this might lose some performance ...