Commit d4029c8f authored by Guido van Rossum's avatar Guido van Rossum

Bug #1608: use -fwrapv when GCC supports it. This is important, newer

GCC versions may optimize away overflow buffer overflow checks without
this option!  Thanks to Ismail Donmez.  No thanks to the GCC devs.
parent 48370450
...@@ -161,6 +161,7 @@ Yves Dionne ...@@ -161,6 +161,7 @@ Yves Dionne
Daniel Dittmar Daniel Dittmar
Walter Drwald Walter Drwald
Jaromir Dolecek Jaromir Dolecek
Ismail Donmez
Dima Dorfman Dima Dorfman
Cesar Douady Cesar Douady
Dean Draayer Dean Draayer
......
...@@ -177,6 +177,10 @@ Documentation ...@@ -177,6 +177,10 @@ Documentation
Build Build
----- -----
- Bug #1608: use -fwrapv when GCC supports it. This is important,
newer GCC versions may optimize away overflow buffer overflow checks
without this option!
- Allow simultaneous installation of 32-bit and 64-bit versions - Allow simultaneous installation of 32-bit and 64-bit versions
on 64-bit Windows systems. on 64-bit Windows systems.
......
...@@ -282,19 +282,6 @@ on these platforms without the special directions mentioned here, ...@@ -282,19 +282,6 @@ on these platforms without the special directions mentioned here,
submit a documentation bug report to SourceForge (see Bug Reports submit a documentation bug report to SourceForge (see Bug Reports
above) so we can remove them!) 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 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 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 module and add a line to sitecustomize.py which makes it the
......
This diff is collapsed.
...@@ -757,6 +757,10 @@ then ...@@ -757,6 +757,10 @@ then
if test "$CC" != 'g++' ; then if test "$CC" != 'g++' ; then
STRICT_PROTO="-Wstrict-prototypes" STRICT_PROTO="-Wstrict-prototypes"
fi fi
# For gcc 4.x we need to 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 case $ac_cv_prog_cc_g in
yes) yes)
if test "$Py_DEBUG" = 'true' ; then if test "$Py_DEBUG" = 'true' ; then
...@@ -764,7 +768,7 @@ then ...@@ -764,7 +768,7 @@ then
# debug builds. # debug builds.
OPT="-g -Wall $STRICT_PROTO" OPT="-g -Wall $STRICT_PROTO"
else else
OPT="-g -O3 -Wall $STRICT_PROTO" OPT="-g $WRAP -O3 -Wall $STRICT_PROTO"
fi fi
;; ;;
*) *)
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment