@@ -4366,6 +4366,67 @@ if test x"$pgac_cv_prog_cc_cflags__fwrapv" = x"yes"; then
43664366 CFLAGS="$CFLAGS -fwrapv"
43674367fi
43684368
4369+ # Disable FP optimizations that cause various errors on gcc 4.5+ or maybe 4.6+
4370+ { $as_echo "$as_me:$LINENO: checking whether $CC supports -fexcess-precision=standard" >&5
4371+ $as_echo_n "checking whether $CC supports -fexcess-precision=standard... " >&6; }
4372+ if test "${pgac_cv_prog_cc_cflags__fexcess_precision_standard+set}" = set; then
4373+ $as_echo_n "(cached) " >&6
4374+ else
4375+ pgac_save_CFLAGS=$CFLAGS
4376+ CFLAGS="$pgac_save_CFLAGS -fexcess-precision=standard"
4377+ ac_save_c_werror_flag=$ac_c_werror_flag
4378+ ac_c_werror_flag=yes
4379+ cat >conftest.$ac_ext <<_ACEOF
4380+ /* confdefs.h. */
4381+ _ACEOF
4382+ cat confdefs.h >>conftest.$ac_ext
4383+ cat >>conftest.$ac_ext <<_ACEOF
4384+ /* end confdefs.h. */
4385+
4386+ int
4387+ main ()
4388+ {
4389+
4390+ ;
4391+ return 0;
4392+ }
4393+ _ACEOF
4394+ rm -f conftest.$ac_objext
4395+ if { (ac_try="$ac_compile"
4396+ case "(($ac_try" in
4397+ *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;;
4398+ *) ac_try_echo=$ac_try;;
4399+ esac
4400+ eval ac_try_echo="\"\$as_me:$LINENO: $ac_try_echo\""
4401+ $as_echo "$ac_try_echo") >&5
4402+ (eval "$ac_compile") 2>conftest.er1
4403+ ac_status=$?
4404+ grep -v '^ *+' conftest.er1 >conftest.err
4405+ rm -f conftest.er1
4406+ cat conftest.err >&5
4407+ $as_echo "$as_me:$LINENO: \$? = $ac_status" >&5
4408+ (exit $ac_status); } && {
4409+ test -z "$ac_c_werror_flag" ||
4410+ test ! -s conftest.err
4411+ } && test -s conftest.$ac_objext; then
4412+ pgac_cv_prog_cc_cflags__fexcess_precision_standard=yes
4413+ else
4414+ $as_echo "$as_me: failed program was:" >&5
4415+ sed 's/^/| /' conftest.$ac_ext >&5
4416+
4417+ pgac_cv_prog_cc_cflags__fexcess_precision_standard=no
4418+ fi
4419+
4420+ rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext
4421+ ac_c_werror_flag=$ac_save_c_werror_flag
4422+ CFLAGS="$pgac_save_CFLAGS"
4423+ fi
4424+ { $as_echo "$as_me:$LINENO: result: $pgac_cv_prog_cc_cflags__fexcess_precision_standard" >&5
4425+ $as_echo "$pgac_cv_prog_cc_cflags__fexcess_precision_standard" >&6; }
4426+ if test x"$pgac_cv_prog_cc_cflags__fexcess_precision_standard" = x"yes"; then
4427+ CFLAGS="$CFLAGS -fexcess-precision=standard"
4428+ fi
4429+
43694430elif test "$ICC" = yes; then
43704431 # Intel's compiler has a bug/misoptimization in checking for
43714432 # division by NAN (NaN == 0), -mp1 fixes it, so add it to the CFLAGS.