diff options
author | Victor Stinner <victor.stinner@gmail.com> | 2017-05-02 08:47:37 (GMT) |
---|---|---|
committer | GitHub <noreply@github.com> | 2017-05-02 08:47:37 (GMT) |
commit | 809101f14f27ddb394cd77c477470761ecf99f41 (patch) | |
tree | c72865d73dfa042b3aa4826ed4c33ace4dd5295e /configure.ac | |
parent | 78b23ab6827410960577c01a33df8afc8fd4496e (diff) | |
download | cpython-809101f14f27ddb394cd77c477470761ecf99f41.zip cpython-809101f14f27ddb394cd77c477470761ecf99f41.tar.gz cpython-809101f14f27ddb394cd77c477470761ecf99f41.tar.bz2 |
bpo-30104: Use -fno-strict-aliasing on clang (#1376)
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. Only compile dtoa.c with -fno-strict-aliasing.
LLVM bug report:
https://bugs.llvm.org//show_bug.cgi?id=31928
Diffstat (limited to 'configure.ac')
-rw-r--r-- | configure.ac | 34 |
1 files changed, 27 insertions, 7 deletions
diff --git a/configure.ac b/configure.ac index 2c8e246..6978b90 100644 --- a/configure.ac +++ b/configure.ac @@ -1447,6 +1447,7 @@ esac # tweak OPT based on compiler and platform, only if the user didn't set # it on the command line AC_SUBST(OPT) +AC_SUBST(CFLAGS_ALIASING) if test "${OPT-unset}" = "unset" then case $GCC in @@ -1459,30 +1460,49 @@ then WRAP="-fwrapv" fi - # Clang also needs -fwrapv case $CC in - *clang*) WRAP="-fwrapv" - ;; + *clang*) + cc_is_clang=1 + ;; + *) + if $CC --version 2>&1 | grep -q clang + then + cc_is_clang=1 + else + cc_is_clang= + fi esac + if test -n "${cc_is_clang}" + then + # Clang also needs -fwrapv + WRAP="-fwrapv" + # bpo-30104: disable strict aliasing to compile correctly dtoa.c, + # see Makefile.pre.in for more information + CFLAGS_ALIASING="-fno-strict-aliasing" + fi + case $ac_cv_prog_cc_g in yes) if test "$Py_DEBUG" = 'true' ; 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" + case $ac_sys_system in SCO_SV*) OPT="$OPT -m486 -DSCO5" ;; |