mirror of https://github.com/python/cpython
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.
This commit is contained in:
parent
483704508d
commit
d4029c8fda
|
@ -161,6 +161,7 @@ Yves Dionne
|
|||
Daniel Dittmar
|
||||
Walter Dörwald
|
||||
Jaromir Dolecek
|
||||
Ismail Donmez
|
||||
Dima Dorfman
|
||||
Cesar Douady
|
||||
Dean Draayer
|
||||
|
|
|
@ -177,6 +177,10 @@ Documentation
|
|||
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
|
||||
on 64-bit Windows systems.
|
||||
|
||||
|
|
13
README
13
README
|
@ -282,19 +282,6 @@ on these platforms without the special directions mentioned here,
|
|||
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
|
||||
|
|
|
@ -757,6 +757,10 @@ then
|
|||
if test "$CC" != 'g++' ; then
|
||||
STRICT_PROTO="-Wstrict-prototypes"
|
||||
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
|
||||
yes)
|
||||
if test "$Py_DEBUG" = 'true' ; then
|
||||
|
@ -764,7 +768,7 @@ then
|
|||
# debug builds.
|
||||
OPT="-g -Wall $STRICT_PROTO"
|
||||
else
|
||||
OPT="-g -O3 -Wall $STRICT_PROTO"
|
||||
OPT="-g $WRAP -O3 -Wall $STRICT_PROTO"
|
||||
fi
|
||||
;;
|
||||
*)
|
||||
|
|
Loading…
Reference in New Issue