https://gcc.gnu.org/bugzilla/show_bug.cgi?id=80042
Bug ID: 80042
Summary: gcc thinks sin/cos don't set errno
Product: gcc
Version: 7.0
Status: UNCONFIRMED
Severity: normal
Priority: P3
Component: middle-end
Assignee: unassigned at gcc dot gnu.org
Reporter: craig.topper at gmail dot com
Target Milestone: ---
Created attachment 40974
--> https://gcc.gnu.org/bugzilla/attachment.cgi?id=40974&action=edit
Test that uses sin and errno
As of glibc version 2.10, sin and cos set errno when the input is infinity. gcc
thinks sin/cos never write errno and will move them around relative to reads of
errno.
The attached test case will return a failing error code at O0 and a passing
error code at O2 when the errno read after the sin call is optimized out.
glibc commit
https://sourceware.org/git/?p=glibc.git;a=commit;f=sysdeps/ieee754/dbl-64/s_sin.c;h=0c59a1963e948c546e0d3e34de974c7e71de1134
I believe sincos was also changed to update errno in 2015
https://sourceware.org/bugzilla/show_bug.cgi?id=15467