http://gcc.gnu.org/bugzilla/show_bug.cgi?id=48979
Sean Santos <quantheory at gmail dot com> changed:
What |Removed |Added
----------------------------------------------------------------------------
CC| |quantheory at gmail dot com
--- Comment #16 from Sean Santos <quantheory at gmail dot com> 2013-04-14
21:28:27 UTC ---
Regarding the above comment:
"You need to have IEEE_EXCEPTIONS or IEEE_ARITHMETIC loaded *in the scoping
unit*, if you want to use IEEE 754 features."
Well, yes and no. There are three cases:
1) If you don't access those modules in a particular scope, it is
"processor-dependent" (e.g. up to the compiler) whether IEEE features are
supported. They can be on or off all the time, or there can be a compiler
option.
2) If you do access those modules, it is *still* "processor-dependent" whether
IEEE features are supported, so that doesn't change. However, this does change:
i) The compiler is allowed to change the level of IEEE support. It is
explicitly allowed to change the degree of support for exceptions. I don't
think that the committee actually intended for support of IEEE NaN and Inf to
change based on whether or not IEEE_ARITHMETIC is in scope, but technically the
standard seems to allow it.
ii) If IEEE_ARITHMETIC is provided, the compiler is required to provide the
IEEE_SUPPORT_* functions so that the program can query them. (However, it is
not supposed to enforce their use at compile time.)
3) If you access IEEE_ARITHMETIC and use "IEEE_NAN" and "IEEE_INF" from
IEEE_FEATURES, the compiler is required to do one of only three things:
i) Error at compile time because it doesn't have one or both modules.
ii) Error at compile time because it has IEEE_FEATURES, but the module
doesn't contain IEEE_NAN/IEEE_INF.
iii) Enable support of IEEE_NAN and IEEE_INF in the scope.
TLDR: If the compiler declares that it doesn't actually have any IEEE support
(which it implicitly does by not providing these modules), it can do anything
it wants. If IEEE_FEATURES was provided, that should probably be used to turn
on IEEE features that are turned off by default because they are inefficient,
not IEEE_ARITHMETIC. If an IEEE feature isn't a significant performance hit, it
may as well be on all the time.