https://gcc.gnu.org/bugzilla/show_bug.cgi?id=88576
Richard Biener <rguenth at gcc dot gnu.org> changed:
What |Removed |Added
----------------------------------------------------------------------------
Assignee|rguenth at gcc dot gnu.org |unassigned at gcc dot
gnu.org
CC| |rguenth at gcc dot gnu.org
Status|ASSIGNED |NEW
--- Comment #16 from Richard Biener <rguenth at gcc dot gnu.org> ---
I'm not actively working on this.
A true conservative solution to track 'errno' is made difficult by the fact
that the C standard does not disallow taking the address of 'errno' (it's a
modifiable lvalue). Meaning our conservative handling with -fmath-errno
is that any access via a int * could possibly alias 'errno'. If that were
not allowed (I've never seen this done in actual code!) then the C/C++
frontends could mark all accesses to errno easily.
See default_ref_may_alias_errno (we have a target hook for this).
Via fnspec we can now have const/pure functions but clobbering errno.
There's two places where the bogus flag_math_errno check are now,
in tree-ssa-alias.cc:check_fnspec and in
ipa-modref.cc:modref_access_analysis::process_fnspec - the builtins.def
math functions should not be affected when changing the two places,
those omit errno from the fnspec in case of -fno-math-errno. That might
not extend to frontends like fortran though.