Andreas Schwab wrote:
Roberto Bagnara bagnara@cs.unipr.it writes:
thanks for your message. Do you mean that we need to enable the FENV_ACCESS pragma to get defined behavior only on the Alpha or also elsewhere?
See the C standard, 7.6.1 The FENV_ACCESS pragma.
The FENV_ACCESS pragma provides a means to inform the implementation when a program might access the floating-point environment to test floating-point status flags or run under non-default floating-point control modes. ... If part of a program tests floating-point status flags, sets floating-point control modes, or runs under non-default mode settings, but was translated with the state for the FENV_ACCESS pragma ‘‘off’’, the behavior is undefined.
I did read that, but I thought that, from a practical (i.e., not legal) standpoint, the issues were constant-propagation and other similar transformations, that is, something that seems unrelated to our testcase.
Sorry if I insist, and thank you in advance for clarifying. Do you mean both the following?
1) Any program calling fetestexcept() without setting FENV_ACCESS "on" has undefined behavior, not only as far as the standard is concerned, but also in the GCC concrete world (meaning that GCC may really do no matter what if fetestexcept() is invoked with FENV_ACCESS "off").
2) GCC does not implement a way to set FENV_ACCESS "on" so that fetestexcept() can be used reliably.
I guess I misunderstood you either on point 1 or on point 2 or on both, because otherwise we would have that any program compiled with GCC and calling fetestexcept() has (in concrete terms) undefined behavior. All the best,
Roberto