On Thu, Aug 07, 2025 at 08:12:44PM +0200, Toon Moene wrote: > On 8/7/25 18:38, Andrew Pinski (QUIC) via Gcc wrote: > > > So looking into https://gcc.gnu.org/bugzilla/show_bug.cgi?id=121448, I > > Noticed the options needed to hit this is `-fsignaling-nans > > -ffinite-math-only`. These 2 options seems contradictory. Should > > -ffinite-math-only turn off signaling nans? Give a warning or something > > else? > > The original intent (around the early 00's) was for -finite-math-only to > indicate that the programmer of the code was certain that valid execution of > said code could only produce finite floating point numbers. > > So this combination of options indeed makes no sense, because NaNs are > "non-finite" floating point bit patterns.
That is still the case. Though, if we do something about this (warn or silently disable or warn and disable), it should be only done in the option finalization, -ffinite-math-only or -ffast-math option when parsed certainly shouldn't turn off -fsignaling-nans, otherwise -fsignaling-nans -ffinite-math-only -fno-finite-math-only will not have signaling nans turned on as it should. Jakub