[Python-checkins] r87931 - in python/branches/py3k-cdecimal/Lib/test/mpdecimal: config.h.in configure configure.in
stefan.krah
python-checkins at python.org
Tue Jan 11 15:35:57 CET 2011
Author: stefan.krah
Date: Tue Jan 11 15:35:57 2011
New Revision: 87931
Log:
Add specific test for the gcc ipa-pure-const bug.
Modified:
python/branches/py3k-cdecimal/Lib/test/mpdecimal/config.h.in
python/branches/py3k-cdecimal/Lib/test/mpdecimal/configure
python/branches/py3k-cdecimal/Lib/test/mpdecimal/configure.in
Modified: python/branches/py3k-cdecimal/Lib/test/mpdecimal/config.h.in
==============================================================================
--- python/branches/py3k-cdecimal/Lib/test/mpdecimal/config.h.in (original)
+++ python/branches/py3k-cdecimal/Lib/test/mpdecimal/config.h.in Tue Jan 11 15:35:57 2011
@@ -1,8 +1,5 @@
/* config.h.in. Generated from configure.in by autoheader. */
-/* Define if the gcc version is 4.5.x. */
-#undef HAVE_GCC_4_5
-
/* Define if we can use x64 gcc inline assembler. */
#undef HAVE_GCC_ASM_FOR_X64
@@ -16,6 +13,9 @@
/* Define to 1 if you have the <inttypes.h> header file. */
#undef HAVE_INTTYPES_H
+/* Define if gcc has the ipa-pure-const bug. */
+#undef HAVE_IPA_PURE_CONST_BUG
+
/* Define to 1 if you have the <memory.h> header file. */
#undef HAVE_MEMORY_H
Modified: python/branches/py3k-cdecimal/Lib/test/mpdecimal/configure
==============================================================================
--- python/branches/py3k-cdecimal/Lib/test/mpdecimal/configure (original)
+++ python/branches/py3k-cdecimal/Lib/test/mpdecimal/configure Tue Jan 11 15:35:57 2011
@@ -4035,26 +4035,56 @@
ppro)
MPD_CONFIG=$M32"-DCONFIG_32 -DPPRO -DASM"
CONFIGURE_LDFLAGS=$M32
- # gcc-4.5 miscompiles inline asm:
+ # Some versions of gcc miscompile inline asm:
# http://gcc.gnu.org/bugzilla/show_bug.cgi?id=46491
# http://gcc.gnu.org/ml/gcc/2010-11/msg00366.html
case $CC in
*gcc*)
- { $as_echo "$as_me:${as_lineno-$LINENO}: checking for gcc-4.5" >&5
-$as_echo_n "checking for gcc-4.5... " >&6; }
- gcc_version=`$CC -dumpversion`
- have_gcc_4_5=no
- case $gcc_version in
- 4.5*)
- have_gcc_4_5=yes
- MPD_CONFIG="$MPD_CONFIG -fno-ipa-pure-const"
-
-$as_echo "#define HAVE_GCC_4_5 1" >>confdefs.h
-
- ;;
- esac
- { $as_echo "$as_me:${as_lineno-$LINENO}: result: $have_gcc_4_5" >&5
-$as_echo "$have_gcc_4_5" >&6; }
+ { $as_echo "$as_me:${as_lineno-$LINENO}: checking for gcc ipa-pure-const bug" >&5
+$as_echo_n "checking for gcc ipa-pure-const bug... " >&6; }
+ saved_cflags="$CFLAGS"
+ CFLAGS="-O2"
+ if test "$cross_compiling" = yes; then :
+ have_ipa_pure_const_bug=undefined
+else
+ cat confdefs.h - <<_ACEOF >conftest.$ac_ext
+/* end confdefs.h. */
+
+ __attribute__((noinline)) int
+ foo(int *p) {
+ int r;
+ asm ( "movl \$6, (%1)\n\t"
+ "xorl %0, %0\n\t"
+ : "=r" (r) : "r" (p) : "memory"
+ );
+ return r;
+ }
+ int main() {
+ int p = 8;
+ if ((foo(&p) ? : p) != 6)
+ return 1;
+ return 0;
+ }
+
+_ACEOF
+if ac_fn_c_try_run "$LINENO"; then :
+ have_ipa_pure_const_bug=no
+else
+ have_ipa_pure_const_bug=yes
+fi
+rm -f core *.core core.conftest.* gmon.out bb.out conftest$ac_exeext \
+ conftest.$ac_objext conftest.beam conftest.$ac_ext
+fi
+
+ CFLAGS="$saved_cflags"
+ { $as_echo "$as_me:${as_lineno-$LINENO}: result: $have_ipa_pure_const_bug" >&5
+$as_echo "$have_ipa_pure_const_bug" >&6; }
+ if test "$have_ipa_pure_const_bug" = yes; then
+ MPD_CONFIG="$MPD_CONFIG -fno-ipa-pure-const"
+
+$as_echo "#define HAVE_IPA_PURE_CONST_BUG 1" >>confdefs.h
+
+ fi
;;
esac
;;
Modified: python/branches/py3k-cdecimal/Lib/test/mpdecimal/configure.in
==============================================================================
--- python/branches/py3k-cdecimal/Lib/test/mpdecimal/configure.in (original)
+++ python/branches/py3k-cdecimal/Lib/test/mpdecimal/configure.in Tue Jan 11 15:35:57 2011
@@ -246,23 +246,41 @@
ppro)
MPD_CONFIG=$M32"-DCONFIG_32 -DPPRO -DASM"
CONFIGURE_LDFLAGS=$M32
- # gcc-4.5 miscompiles inline asm:
+ # Some versions of gcc miscompile inline asm:
# http://gcc.gnu.org/bugzilla/show_bug.cgi?id=46491
# http://gcc.gnu.org/ml/gcc/2010-11/msg00366.html
case $CC in
*gcc*)
- AC_MSG_CHECKING(for gcc-4.5)
- gcc_version=`$CC -dumpversion`
- have_gcc_4_5=no
- case $gcc_version in
- 4.5*)
- have_gcc_4_5=yes
- MPD_CONFIG="$MPD_CONFIG -fno-ipa-pure-const"
- AC_DEFINE(HAVE_GCC_4_5, 1,
- [Define if the gcc version is 4.5.x.])
- ;;
- esac
- AC_MSG_RESULT($have_gcc_4_5)
+ AC_MSG_CHECKING(for gcc ipa-pure-const bug)
+ saved_cflags="$CFLAGS"
+ CFLAGS="-O2"
+ AC_RUN_IFELSE([AC_LANG_SOURCE([[
+ __attribute__((noinline)) int
+ foo(int *p) {
+ int r;
+ asm ( "movl \$6, (%1)\n\t"
+ "xorl %0, %0\n\t"
+ : "=r" (r) : "r" (p) : "memory"
+ );
+ return r;
+ }
+ int main() {
+ int p = 8;
+ if ((foo(&p) ? : p) != 6)
+ return 1;
+ return 0;
+ }
+ ]])],
+ [have_ipa_pure_const_bug=no],
+ [have_ipa_pure_const_bug=yes],
+ [have_ipa_pure_const_bug=undefined])
+ CFLAGS="$saved_cflags"
+ AC_MSG_RESULT($have_ipa_pure_const_bug)
+ if test "$have_ipa_pure_const_bug" = yes; then
+ MPD_CONFIG="$MPD_CONFIG -fno-ipa-pure-const"
+ AC_DEFINE(HAVE_IPA_PURE_CONST_BUG, 1,
+ [Define if gcc has the ipa-pure-const bug.])
+ fi
;;
esac
;;
More information about the Python-checkins
mailing list