This is the mail archive of the
mailing list for the GCC project.
Re: fast_math_flags_set_p vs. set_fast_math_flags inconsistency?
- From: Joseph Myers <joseph at codesourcery dot com>
- To: Ulrich Weigand <uweigand at de dot ibm dot com>
- Cc: <gcc at gcc dot gnu dot org>
- Date: Tue, 21 Jan 2020 16:58:40 +0000
- Subject: Re: fast_math_flags_set_p vs. set_fast_math_flags inconsistency?
- Ironport-sdr: HaydGI0m5itsK3C+BYOhUpkEBgcVS3OPVOUpO2gqPSyWVBPyqF885uSsXtliFC71mWUEM1IQ6f kBEwPN3c1w4TQbY8UzuCbompGj+1Vh4lFLkdERAhBTNlJTgQ5/F8ueaR2f1xlK15hXE5tlxpWY IYUN5xSWnrMsfOLlYvrTHzBqI87kWg/bVlxMHLt2cPEbdkW13vOqilGrwOJvXk/7R5EBAK3g41 T398iC0iM/R8FtXnCQcRwikMUf+G9H7j2HK5BAKPCSFf2jYEwOpOIJH3PpJhVg1gVVnErrFnQx 3lI=
- Ironport-sdr: wo98nmK5Od17VOaLcQih20kBmXoULIvIn6ioCMB3NosF3pr1A8GGVePBwp+UD4k/Nb2v1cps/C zIuYLnr7X3Aw==
- References: <20200121135033.817CCD802DA@oc3748833570.ibm.com>
On Tue, 21 Jan 2020, Ulrich Weigand wrote:
> It looks like there's multiple cases here. For the two flags
> -fassociative-math and -freciprocal-math, it seems to have happened just as
> you describe: they were created (split out of -funsafe-math-optimizations)
> in commit a1a826110720eda37c73f829daa4ee243ee953f5, which however did not
> update fast_math_flags_set_p.
So that's a bug.
> For the other three flags, -fsignaling-nans, -frounding-math, and
> -fcx-limited-range, the story appears to be a bit different: from the
The first two of those are disabled by default as well as disabled by
-ffast-math, so it seems right that -fno-fast-math does nothing with them
and that they aren't checked by fast_math_flags_set_p.
The last one is disabled by default but enabled by -ffast-math. So it
would seem appropriate to handle it like other such options, disable it
with -fno-fast-math, and check it in fast_math_flags_set_p.
> Finally, there is one "mixed" flag, -fexcess-precision, which is handled
> like the above three in that its default is only modified as a result of
> -ffast-math, not -fno-fast-math; but nevertheless this flag *is* checked
> in fast_math_flags_set_p.
That one's trickier because the default depends on whether a C standards
conformance mode is specified.
Joseph S. Myers