Skip to content

Commit 517462f

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 6c0a375 commit 517462f

File tree

2 files changed

+53
-0
lines changed

2 files changed

+53
-0
lines changed

configure

Lines changed: 51 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -4199,6 +4199,57 @@ sed 's/^/| /' conftest.$ac_ext >&5
41994199
$as_echo "no" >&6; }
42004200
fi
42014201

4202+
rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext
4203+
4204+
# Disable FP optimizations that cause various errors on gcc 4.5+ or maybe 4.6+
4205+
{ $as_echo "$as_me:$LINENO: checking if $CC supports -fexcess-precision=standard" >&5
4206+
$as_echo_n "checking if $CC supports -fexcess-precision=standard... " >&6; }
4207+
pgac_save_CFLAGS=$CFLAGS
4208+
CFLAGS="$pgac_save_CFLAGS -fexcess-precision=standard"
4209+
cat >conftest.$ac_ext <<_ACEOF
4210+
/* confdefs.h. */
4211+
_ACEOF
4212+
cat confdefs.h >>conftest.$ac_ext
4213+
cat >>conftest.$ac_ext <<_ACEOF
4214+
/* end confdefs.h. */
4215+
4216+
int
4217+
main ()
4218+
{
4219+
4220+
;
4221+
return 0;
4222+
}
4223+
_ACEOF
4224+
rm -f conftest.$ac_objext
4225+
if { (ac_try="$ac_compile"
4226+
case "(($ac_try" in
4227+
*\"* | *\`* | *\\*) ac_try_echo=\$ac_try;;
4228+
*) ac_try_echo=$ac_try;;
4229+
esac
4230+
eval ac_try_echo="\"\$as_me:$LINENO: $ac_try_echo\""
4231+
$as_echo "$ac_try_echo") >&5
4232+
(eval "$ac_compile") 2>conftest.er1
4233+
ac_status=$?
4234+
grep -v '^ *+' conftest.er1 >conftest.err
4235+
rm -f conftest.er1
4236+
cat conftest.err >&5
4237+
$as_echo "$as_me:$LINENO: \$? = $ac_status" >&5
4238+
(exit $ac_status); } && {
4239+
test -z "$ac_c_werror_flag" ||
4240+
test ! -s conftest.err
4241+
} && test -s conftest.$ac_objext; then
4242+
{ $as_echo "$as_me:$LINENO: result: yes" >&5
4243+
$as_echo "yes" >&6; }
4244+
else
4245+
$as_echo "$as_me: failed program was:" >&5
4246+
sed 's/^/| /' conftest.$ac_ext >&5
4247+
4248+
CFLAGS="$pgac_save_CFLAGS"
4249+
{ $as_echo "$as_me:$LINENO: result: no" >&5
4250+
$as_echo "no" >&6; }
4251+
fi
4252+
42024253
rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext
42034254

42044255
elif test "$ICC" = yes; then

configure.in

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

0 commit comments

Comments
 (0)