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

fuscated at gmail dot com gcc-bugzilla@gcc.gnu.org
Fri Dec 14 15:29:00 GMT 2018


https://gcc.gnu.org/bugzilla/show_bug.cgi?id=88499

--- Comment #1 from Teodor Petrov <fuscated at gmail dot com> ---
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.


More information about the Gcc-bugs mailing list