https://gcc.gnu.org/bugzilla/show_bug.cgi?id=78249
Bug ID: 78249 Summary: In consistent results for 0.0 * inf when optimizer is enabled Product: gcc Version: 6.1.1 Status: UNCONFIRMED Severity: normal Priority: P3 Component: c++ Assignee: unassigned at gcc dot gnu.org Reporter: joshua.england at worldprogramming dot com Target Milestone: --- Created attachment 39988 --> https://gcc.gnu.org/bugzilla/attachment.cgi?id=39988&action=edit Code and make file to show the bug The following code gives -NAN when not optimized and NAN when optimized (note the change in sign). double x = 0.0 * std::numeric_limits<double>::infinity(); The attachment contains FORTRAN code as the project I am working on requires linking to FORTRAN code. I discovered the problem because of inconsistent results between the output from GFORTRAN and G++ give similar code.