Location via proxy:   [ UP ]  
[Report a bug]   [Manage cookies]                
Skip to content

Commit 24b9680

Browse files
committed
Disable excessive FP optimization by recent versions of gcc.
Suggested solution from Tom Lane. Problem discovered, probably not for the first time, while testing the mingw-w64 32 bit compiler. Backpatched to all live branches.
1 parent 6cf639d commit 24b9680

File tree

2 files changed

+63
-0
lines changed

2 files changed

+63
-0
lines changed

configure

Lines changed: 61 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -4306,6 +4306,67 @@ if test x"$pgac_cv_prog_cc_cflags__fwrapv" = x"yes"; then
43064306
CFLAGS="$CFLAGS -fwrapv"
43074307
fi
43084308

4309+
# Disable FP optimizations that cause various errors on gcc 4.5+ or maybe 4.6+
4310+
{ $as_echo "$as_me:$LINENO: checking whether $CC supports -fexcess-precision=standard" >&5
4311+
$as_echo_n "checking whether $CC supports -fexcess-precision=standard... " >&6; }
4312+
if test "${pgac_cv_prog_cc_cflags__fexcess_precision_standard+set}" = set; then
4313+
$as_echo_n "(cached) " >&6
4314+
else
4315+
pgac_save_CFLAGS=$CFLAGS
4316+
CFLAGS="$pgac_save_CFLAGS -fexcess-precision=standard"
4317+
ac_save_c_werror_flag=$ac_c_werror_flag
4318+
ac_c_werror_flag=yes
4319+
cat >conftest.$ac_ext <<_ACEOF
4320+
/* confdefs.h. */
4321+
_ACEOF
4322+
cat confdefs.h >>conftest.$ac_ext
4323+
cat >>conftest.$ac_ext <<_ACEOF
4324+
/* end confdefs.h. */
4325+
4326+
int
4327+
main ()
4328+
{
4329+
4330+
;
4331+
return 0;
4332+
}
4333+
_ACEOF
4334+
rm -f conftest.$ac_objext
4335+
if { (ac_try="$ac_compile"
4336+
case "(($ac_try" in
4337+
*\"* | *\`* | *\\*) ac_try_echo=\$ac_try;;
4338+
*) ac_try_echo=$ac_try;;
4339+
esac
4340+
eval ac_try_echo="\"\$as_me:$LINENO: $ac_try_echo\""
4341+
$as_echo "$ac_try_echo") >&5
4342+
(eval "$ac_compile") 2>conftest.er1
4343+
ac_status=$?
4344+
grep -v '^ *+' conftest.er1 >conftest.err
4345+
rm -f conftest.er1
4346+
cat conftest.err >&5
4347+
$as_echo "$as_me:$LINENO: \$? = $ac_status" >&5
4348+
(exit $ac_status); } && {
4349+
test -z "$ac_c_werror_flag" ||
4350+
test ! -s conftest.err
4351+
} && test -s conftest.$ac_objext; then
4352+
pgac_cv_prog_cc_cflags__fexcess_precision_standard=yes
4353+
else
4354+
$as_echo "$as_me: failed program was:" >&5
4355+
sed 's/^/| /' conftest.$ac_ext >&5
4356+
4357+
pgac_cv_prog_cc_cflags__fexcess_precision_standard=no
4358+
fi
4359+
4360+
rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext
4361+
ac_c_werror_flag=$ac_save_c_werror_flag
4362+
CFLAGS="$pgac_save_CFLAGS"
4363+
fi
4364+
{ $as_echo "$as_me:$LINENO: result: $pgac_cv_prog_cc_cflags__fexcess_precision_standard" >&5
4365+
$as_echo "$pgac_cv_prog_cc_cflags__fexcess_precision_standard" >&6; }
4366+
if test x"$pgac_cv_prog_cc_cflags__fexcess_precision_standard" = x"yes"; then
4367+
CFLAGS="$CFLAGS -fexcess-precision=standard"
4368+
fi
4369+
43094370
elif test "$ICC" = yes; then
43104371
# Intel's compiler has a bug/misoptimization in checking for
43114372
# division by NAN (NaN == 0), -mp1 fixes it, so add it to the CFLAGS.

configure.in

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -436,6 +436,8 @@ if test "$GCC" = yes -a "$ICC" = no; then
436436
PGAC_PROG_CC_CFLAGS_OPT([-fno-strict-aliasing])
437437
# Disable optimizations that assume no overflow; needed for gcc 4.3+
438438
PGAC_PROG_CC_CFLAGS_OPT([-fwrapv])
439+
# Disable FP optimizations that cause various errors on gcc 4.5+ or maybe 4.6+
440+
PGAC_PROG_CC_CFLAGS_OPT([-fexcess-precision=standard])
439441
elif test "$ICC" = yes; then
440442
# Intel's compiler has a bug/misoptimization in checking for
441443
# division by NAN (NaN == 0), -mp1 fixes it, so add it to the CFLAGS.

0 commit comments

Comments
 (0)