Richard Biener wrote:

> There are a number of regression tests that check for errno handling
> (I added some to avoid aliasing for example).  Please make sure to
> add explicit -fmath-errno to those that do not already have it set
> (I guess such patch would be obvious and independent of this one).

All the tests apart from the ones I fixed are already correct, explicitly
setting -f(no-)math-errno if necessary, or they are unrelated to math
functions (eg. testing errno after strtol or mprotect).

> A grep -r errno testsuite/ is only 159 lines but it might not
> catch all cases - the one I'm refering to above matches because
> of a comment only:
>
> testsuite/gcc.dg/tree-ssa/ssa-dse-15.c:  /* We should be able to DSE this 
> store
> (p may point to errno).  */

That one has after my patch:
/* { dg-options "-O2 -fdump-tree-dse1-details -fmath-errno" } */

> Following Josephs comment it may be reasonable to have the default
> depend on the targets C library and thus make it a target macro (IIRC
> the BSD libc never set errno for any math function for example).

Targets can override the math-errno default using the existing option
infrastructure if required. However even with softfloat one can test the
return value for Infinity/NaN, so even in that case errno is only required
if the application relies on it and the C library supports it.

> Josephs comment indicates conformance issues with a
> -fno-math-errno -fno-trapping-math combination (-ftrapping-math
> is default).

Maybe, it depends on what exactly -ftrapping-math implies, and that
is still unclear to me.

Wilco

Reply via email to