https://gcc.gnu.org/bugzilla/show_bug.cgi?id=71615
Bug ID: 71615 Summary: wrong float point result with {-Ofast, -march=native, and valgrind} Product: gcc Version: 5.3.1 Status: UNCONFIRMED Severity: major Priority: P3 Component: fortran Assignee: unassigned at gcc dot gnu.org Reporter: wangmianzhi1 at linuxmail dot org Target Milestone: --- Created attachment 38742 --> https://gcc.gnu.org/bugzilla/attachment.cgi?id=38742&action=edit reduced test Problem: float point calculation gives wrong result Hardware: AMD A4-5000 CPU Software: Ubuntu 16.04 x86_64 gcc and valgrind from apt Steps to Repeat the Bug: 1. compile the attached REDUCED test code with $ gfortran -Wall -Ofast -march=native test.f90 -o test 2. execute the program via valgrind $ valgriand ./test Result: The calculation gives 0.0000000000000000 -2.6901205975860183 0.95110109754591643 While the correct result should be 0.0000000000000000 -0.94280905929685954 0.33333328322831940 Note: Would give the correct result WITHOUT ANY of {-Ofast, -march=native, or valgrind}.