summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorMartin v. Löwis <martin@v.loewis.de>2003-07-07 21:26:19 (GMT)
committerMartin v. Löwis <martin@v.loewis.de>2003-07-07 21:26:19 (GMT)
commit70fedcd583e1fe6ce2194691c546a0350f9a87fe (patch)
tree136004645da5af79b0eae2165eb93adb29995cf6
parentdfda8d79ee0a1eabdcbda8648681fb2bf42a81e5 (diff)
downloadcpython-70fedcd583e1fe6ce2194691c546a0350f9a87fe.zip
cpython-70fedcd583e1fe6ce2194691c546a0350f9a87fe.tar.gz
cpython-70fedcd583e1fe6ce2194691c546a0350f9a87fe.tar.bz2
Use -fno-strict-aliasing if available. Fixes #766696. Will backport to 2.2.
-rwxr-xr-xconfigure45
-rw-r--r--configure.in16
2 files changed, 60 insertions, 1 deletions
diff --git a/configure b/configure
index 3f4ed4d..dc31f16 100755
--- a/configure
+++ b/configure
@@ -1,5 +1,5 @@
#! /bin/sh
-# From configure.in Revision: 1.421 .
+# From configure.in Revision: 1.422 .
# Guess values for system-dependent variables and create Makefiles.
# Generated by GNU Autoconf 2.53 for python 2.3.
#
@@ -3645,6 +3645,49 @@ fi
# tweak BASECFLAGS based on compiler and platform
case $GCC in
yes)
+ # Python violates C99 rules, by casting between incompatible
+ # pointer types. GCC may generate bad code as a result of that,
+ # so use -fno-strict-aliasing if supported.
+ echo "$as_me:$LINENO: checking whether $CC accepts -fno-strict-aliasing" >&5
+echo $ECHO_N "checking whether $CC accepts -fno-strict-aliasing... $ECHO_C" >&6
+ ac_save_cc="$CC"
+ CC="$CC -fno-strict-aliasing"
+ if test "$cross_compiling" = yes; then
+ ac_cv_no_strict_aliasing_ok=no
+else
+ cat >conftest.$ac_ext <<_ACEOF
+#line $LINENO "configure"
+#include "confdefs.h"
+int main() { return 0; }
+_ACEOF
+rm -f conftest$ac_exeext
+if { (eval echo "$as_me:$LINENO: \"$ac_link\"") >&5
+ (eval $ac_link) 2>&5
+ ac_status=$?
+ echo "$as_me:$LINENO: \$? = $ac_status" >&5
+ (exit $ac_status); } && { ac_try='./conftest$ac_exeext'
+ { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5
+ (eval $ac_try) 2>&5
+ ac_status=$?
+ echo "$as_me:$LINENO: \$? = $ac_status" >&5
+ (exit $ac_status); }; }; then
+ ac_cv_no_strict_aliasing_ok=yes
+else
+ echo "$as_me: program exited with status $ac_status" >&5
+echo "$as_me: failed program was:" >&5
+cat conftest.$ac_ext >&5
+( exit $ac_status )
+ac_cv_no_strict_aliasing_ok=no
+fi
+rm -f core core.* *.core conftest$ac_exeext conftest.$ac_objext conftest.$ac_ext
+fi
+ CC="$ac_save_cc"
+ echo "$as_me:$LINENO: result: $ac_cv_no_strict_aliasing_ok" >&5
+echo "${ECHO_T}$ac_cv_no_strict_aliasing_ok" >&6
+ if test $ac_cv_no_strict_aliasing_ok = yes
+ then
+ BASECFLAGS="$BASECFLAGS -fno-strict-aliasing"
+ fi
case $ac_sys_system in
SCO_SV*)
BASECFLAGS="$BASECFLAGS -m486 -DSCO5"
diff --git a/configure.in b/configure.in
index 8ab79b5..210eab3 100644
--- a/configure.in
+++ b/configure.in
@@ -641,6 +641,22 @@ AC_SUBST(BASECFLAGS)
# tweak BASECFLAGS based on compiler and platform
case $GCC in
yes)
+ # Python violates C99 rules, by casting between incompatible
+ # pointer types. GCC may generate bad code as a result of that,
+ # so use -fno-strict-aliasing if supported.
+ AC_MSG_CHECKING(whether $CC accepts -fno-strict-aliasing)
+ ac_save_cc="$CC"
+ CC="$CC -fno-strict-aliasing"
+ AC_TRY_RUN([int main() { return 0; }],
+ ac_cv_no_strict_aliasing_ok=yes,
+ ac_cv_no_strict_aliasing_ok=no,
+ ac_cv_no_strict_aliasing_ok=no)
+ CC="$ac_save_cc"
+ AC_MSG_RESULT($ac_cv_no_strict_aliasing_ok)
+ if test $ac_cv_no_strict_aliasing_ok = yes
+ then
+ BASECFLAGS="$BASECFLAGS -fno-strict-aliasing"
+ fi
case $ac_sys_system in
SCO_SV*)
BASECFLAGS="$BASECFLAGS -m486 -DSCO5"