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.