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
This commit is contained in:
parent
791dc83119
commit
28205b203a
|
@ -6814,7 +6814,14 @@ then
|
||||||
|
|
||||||
# Clang also needs -fwrapv
|
# Clang also needs -fwrapv
|
||||||
case $CC in
|
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
|
esac
|
||||||
|
|
||||||
|
@ -6824,18 +6831,21 @@ then
|
||||||
# Optimization messes up debuggers, so turn it off for
|
# Optimization messes up debuggers, so turn it off for
|
||||||
# debug builds.
|
# debug builds.
|
||||||
if "$CC" -v --help 2>/dev/null |grep -- -Og > /dev/null; then
|
if "$CC" -v --help 2>/dev/null |grep -- -Og > /dev/null; then
|
||||||
OPT="-g -Og -Wall $STRICT_PROTO"
|
OPT="-g -Og -Wall"
|
||||||
else
|
else
|
||||||
OPT="-g -O0 -Wall $STRICT_PROTO"
|
OPT="-g -O0 -Wall"
|
||||||
fi
|
fi
|
||||||
else
|
else
|
||||||
OPT="-g $WRAP -O3 -Wall $STRICT_PROTO"
|
OPT="-g $WRAP -O3 -Wall"
|
||||||
fi
|
fi
|
||||||
;;
|
;;
|
||||||
*)
|
*)
|
||||||
OPT="-O3 -Wall $STRICT_PROTO"
|
OPT="-O3 -Wall"
|
||||||
;;
|
;;
|
||||||
esac
|
esac
|
||||||
|
|
||||||
|
OPT="$OPT $STRICT_PROTO $ALIASING"
|
||||||
|
|
||||||
case $ac_sys_system in
|
case $ac_sys_system in
|
||||||
SCO_SV*) OPT="$OPT -m486 -DSCO5"
|
SCO_SV*) OPT="$OPT -m486 -DSCO5"
|
||||||
;;
|
;;
|
||||||
|
|
20
configure.ac
20
configure.ac
|
@ -1454,7 +1454,14 @@ then
|
||||||
|
|
||||||
# Clang also needs -fwrapv
|
# Clang also needs -fwrapv
|
||||||
case $CC in
|
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
|
esac
|
||||||
|
|
||||||
|
@ -1464,18 +1471,21 @@ then
|
||||||
# Optimization messes up debuggers, so turn it off for
|
# Optimization messes up debuggers, so turn it off for
|
||||||
# debug builds.
|
# debug builds.
|
||||||
if "$CC" -v --help 2>/dev/null |grep -- -Og > /dev/null; then
|
if "$CC" -v --help 2>/dev/null |grep -- -Og > /dev/null; then
|
||||||
OPT="-g -Og -Wall $STRICT_PROTO"
|
OPT="-g -Og -Wall"
|
||||||
else
|
else
|
||||||
OPT="-g -O0 -Wall $STRICT_PROTO"
|
OPT="-g -O0 -Wall"
|
||||||
fi
|
fi
|
||||||
else
|
else
|
||||||
OPT="-g $WRAP -O3 -Wall $STRICT_PROTO"
|
OPT="-g $WRAP -O3 -Wall"
|
||||||
fi
|
fi
|
||||||
;;
|
;;
|
||||||
*)
|
*)
|
||||||
OPT="-O3 -Wall $STRICT_PROTO"
|
OPT="-O3 -Wall"
|
||||||
;;
|
;;
|
||||||
esac
|
esac
|
||||||
|
|
||||||
|
OPT="$OPT $STRICT_PROTO $ALIASING"
|
||||||
|
|
||||||
case $ac_sys_system in
|
case $ac_sys_system in
|
||||||
SCO_SV*) OPT="$OPT -m486 -DSCO5"
|
SCO_SV*) OPT="$OPT -m486 -DSCO5"
|
||||||
;;
|
;;
|
||||||
|
|
Loading…
Reference in New Issue