[Bug other/88499] Check for less than zero removed before floating point division causes division by zero (fast-math mode)

2018-12-14 Thread pinskia at gcc dot gnu.org
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=88499

Andrew Pinski  changed:

   What|Removed |Added

 Status|UNCONFIRMED |RESOLVED
 Resolution|--- |INVALID

--- Comment #4 from Andrew Pinski  ---
You need to turn back on trapping math, -ftrapping-math for this to work
correctly.  -ftrapping-math is turned off with -ffast-math.

[Bug other/88499] Check for less than zero removed before floating point division causes division by zero (fast-math mode)

2018-12-14 Thread fuscated at gmail dot com
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=88499

--- Comment #3 from Teodor Petrov  ---
@Marc Glisse: Would it be possible to give an explanation why this is not a
good idea? Link to some kind of a documentation which explains that this
behaviour is expected?

[Bug other/88499] Check for less than zero removed before floating point division causes division by zero (fast-math mode)

2018-12-14 Thread glisse at gcc dot gnu.org
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=88499

--- Comment #2 from Marc Glisse  ---
I don't think using fenv.h with -ffast-math makes much sense.

[Bug other/88499] Check for less than zero removed before floating point division causes division by zero (fast-math mode)

2018-12-14 Thread fuscated at gmail dot com
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=88499

--- Comment #1 from Teodor Petrov  ---
Here are the commands used to reproduce the bug:
$ g++ -g -fPIC -Ofast  -msse4.2 -std=c++11 -ffunction-sections -fdata-sections
-ffast-math -fvisibility=hidden -fexceptions -Wno-c++11-extensions
gcc_division.cpp 
$ ./a.out 
p=0.000; i=0
Floating point exception (core dumped)

If I move the if-else which sets the y0 outside of the loop just after the
printf call it works as expected and there is no SIGFPE.