This is the mail archive of the gcc-bugs@gcc.gnu.org mailing list for the GCC project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

[Bug tree-optimization/43716] [4.6/4.7/4.8 Regression] Revision 158105 miscompiles doduc.f90


http://gcc.gnu.org/bugzilla/show_bug.cgi?id=43716

--- Comment #48 from Dominique d'Humieres <dominiq at lps dot ens.fr> 2013-01-08 19:52:39 UTC ---
>From comment #40:

> with -ffast-math, so for example
>
>   if (x != 0)
>     tem = y / x;
>   else
>     tem = 0.;
>   ... do sth with tem ...
>
> will execute y / x unconditionally based on the fact that it cannot trap.

This optimization generates an exception trapped when using -ffpe-trap=invalid
along with -ffast-math.
This unfortunately prevents any debugging based -ffpe-trap=invalid for
miscompilations occurring with -ffast-math. One thing I hope, though I am not
sure about it, is that the above block is still compiled as

tem=y/x
if (x==0) tem=0.

My original report was for '-O3 -funsafe-math-optimizations -ffinite-math-only'
without -ffpe-trap=invalid. The segmentation fault resulted from the fact that
some variables were used to access a table and were out of bound when the
miscompilation generated some NAN (see comment #13).


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]