Ismail Donmez added the comment:

Attached patch exactly checks if compiler supports -fwrapv otherwise
doesn't use it. Is this ok?

Added file: http://bugs.python.org/file8944/wrap.patch

__________________________________
Tracker <[EMAIL PROTECTED]>
<http://bugs.python.org/issue1608>
__________________________________
Index: configure.in
===================================================================
--- configure.in	(revision 59479)
+++ configure.in	(working copy)
@@ -757,6 +757,10 @@
         if test "$CC" != 'g++' ; then
 	    STRICT_PROTO="-Wstrict-prototypes"
 	fi
+        # For gcc 4.x we need use fwrapv so lets check if its supported
+        if "$CC" -v --help 2>/dev/null |grep -- -fwrapv > /dev/null; then
+           WRAP="-fwrapv"
+        fi
 	case $ac_cv_prog_cc_g in
 	yes)
 	    if test "$Py_DEBUG" = 'true' ; then
@@ -764,7 +768,7 @@
 		# debug builds.
 		OPT="-g -Wall $STRICT_PROTO"
 	    else
-		OPT="-g -O3 -Wall $STRICT_PROTO"
+		OPT="-g $WRAP -O3 -Wall $STRICT_PROTO"
 	    fi
 	    ;;
 	*)
Index: README
===================================================================
--- README	(revision 59479)
+++ README	(working copy)
@@ -282,19 +282,6 @@
 submit a documentation bug report to SourceForge (see Bug Reports
 above) so we can remove them!)
 
-GCC 4.1,
-GCC 4.2: There is a known incompatibility between Python and GCC,
-         where GCC 4.1 and later uses an interpretation of C 
-         different to earlier GCC releases in an area where the C 
-         specification has undefined behaviour (namely, integer arithmetic 
-         involving -sys.maxint-1).
-
-	 As a consequence, compiling Python with GCC 4.1/4.2 is not
-	 recommended. It is likely that this problem will be resolved
-	 in future Python releases. As a work-around, it seems that
-	 adding -fwrapv to the compiler options restores the earlier
-	 GCC behaviour.
-
 Unix platforms: If your vendor still ships (and you still use) Berkeley DB
         1.85 you will need to edit Modules/Setup to build the bsddb185
         module and add a line to sitecustomize.py which makes it the
_______________________________________________
Python-bugs-list mailing list 
Unsubscribe: 
http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com

Reply via email to