summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorVictor Stinner <victor.stinner@gmail.com>2017-04-21 09:24:34 (GMT)
committerGitHub <noreply@github.com>2017-04-21 09:24:34 (GMT)
commit28205b203a4742c40080b4a2b4b2dcd800716edc (patch)
treecf926f066b2c8b2e3b2f5273475f751ba877ba03
parent791dc831198f3ecc1531f8e6f05debf4ce234d00 (diff)
downloadcpython-28205b203a4742c40080b4a2b4b2dcd800716edc.zip
cpython-28205b203a4742c40080b4a2b4b2dcd800716edc.tar.gz
cpython-28205b203a4742c40080b4a2b4b2dcd800716edc.tar.bz2
bpo-30104: Use -fno-strict-aliasing on clang (#1221)
Python/dtoa.c is not compiled correctly with clang 4.0 and optimization level -O2 or higher, because of an aliasing issue on the double/ULong[2] union. LLVM bug report: https://bugs.llvm.org//show_bug.cgi?id=31928
-rwxr-xr-xconfigure22
-rw-r--r--configure.ac22
2 files changed, 32 insertions, 12 deletions
diff --git a/configure b/configure
index b4dc5f1..40e64ad 100755
--- a/configure
+++ b/configure
@@ -6814,8 +6814,15 @@ then
# Clang also needs -fwrapv
case $CC in
- *clang*) WRAP="-fwrapv"
- ;;
+ *clang*)
+ WRAP="-fwrapv"
+ # bpo-30104: Python/dtoa.c requires to be build with
+ # -fno-strict-aliasing to fix compiler issue on the
+ # double/ULong[2] union using clang 4.0 and optimization level
+ # -O2 or higher
+ # https://bugs.llvm.org//show_bug.cgi?id=31928
+ ALIASING="-fno-strict-aliasing"
+ ;;
esac
case $ac_cv_prog_cc_g in
@@ -6824,18 +6831,21 @@ then
# Optimization messes up debuggers, so turn it off for
# debug builds.
if "$CC" -v --help 2>/dev/null |grep -- -Og > /dev/null; then
- OPT="-g -Og -Wall $STRICT_PROTO"
+ OPT="-g -Og -Wall"
else
- OPT="-g -O0 -Wall $STRICT_PROTO"
+ OPT="-g -O0 -Wall"
fi
else
- OPT="-g $WRAP -O3 -Wall $STRICT_PROTO"
+ OPT="-g $WRAP -O3 -Wall"
fi
;;
*)
- OPT="-O3 -Wall $STRICT_PROTO"
+ OPT="-O3 -Wall"
;;
esac
+
+ OPT="$OPT $STRICT_PROTO $ALIASING"
+
case $ac_sys_system in
SCO_SV*) OPT="$OPT -m486 -DSCO5"
;;
diff --git a/configure.ac b/configure.ac
index d7316b9..cb79ea8 100644
--- a/configure.ac
+++ b/configure.ac
@@ -1454,8 +1454,15 @@ then
# Clang also needs -fwrapv
case $CC in
- *clang*) WRAP="-fwrapv"
- ;;
+ *clang*)
+ WRAP="-fwrapv"
+ # bpo-30104: Python/dtoa.c requires to be build with
+ # -fno-strict-aliasing to fix compiler issue on the
+ # double/ULong[2] union using clang 4.0 and optimization level
+ # -O2 or higher
+ # https://bugs.llvm.org//show_bug.cgi?id=31928
+ ALIASING="-fno-strict-aliasing"
+ ;;
esac
case $ac_cv_prog_cc_g in
@@ -1464,18 +1471,21 @@ then
# Optimization messes up debuggers, so turn it off for
# debug builds.
if "$CC" -v --help 2>/dev/null |grep -- -Og > /dev/null; then
- OPT="-g -Og -Wall $STRICT_PROTO"
+ OPT="-g -Og -Wall"
else
- OPT="-g -O0 -Wall $STRICT_PROTO"
+ OPT="-g -O0 -Wall"
fi
else
- OPT="-g $WRAP -O3 -Wall $STRICT_PROTO"
+ OPT="-g $WRAP -O3 -Wall"
fi
;;
*)
- OPT="-O3 -Wall $STRICT_PROTO"
+ OPT="-O3 -Wall"
;;
esac
+
+ OPT="$OPT $STRICT_PROTO $ALIASING"
+
case $ac_sys_system in
SCO_SV*) OPT="$OPT -m486 -DSCO5"
;;