| FazBrowse GitHub Viewer | Trending | | Home |
| Tools: [Download Repo ZIP] [Original HTTPS Page] |
1 parent e37d163 commit 03a7ab7
3 files changed
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
@@ -103,6 +103,8 @@ ARFLAGS= @ARFLAGS@ | |||
| 103 | 103 | CFLAGSFORSHARED=@CFLAGSFORSHARED@ | |
| 104 | 104 | # C flags used for building the interpreter object files | |
| 105 | 105 | PY_CORE_CFLAGS= $(PY_CFLAGS) $(PY_CFLAGS_NODIST) $(PY_CPPFLAGS) $(CFLAGSFORSHARED) -DPy_BUILD_CORE | |
| 106 | + # Strict or non-strict aliasing flags used to compile dtoa.c, see above | ||
| 107 | + CFLAGS_ALIASING=@CFLAGS_ALIASING@ | ||
| 106 | 108 | ||
| 107 | 109 | ||
| 108 | 110 | # Machine-dependent subdirectories | |
@@ -1532,6 +1534,13 @@ config.status: $(srcdir)/configure | |||
| 1532 | 1534 | .c.o: | |
| 1533 | 1535 | $(CC) -c $(PY_CORE_CFLAGS) -o $@ $< | |
| 1534 | 1536 | ||
| 1537 | + # bpo-30104: dtoa.c uses union to cast double to unsigned long[2]. clang 4.0 | ||
| 1538 | + # with -O2 or higher and strict aliasing miscompiles the ratio() function | ||
| 1539 | + # causing rounding issues. Compile dtoa.c using -fno-strict-aliasing on clang. | ||
| 1540 | + # https://bugs.llvm.org//show_bug.cgi?id=31928 | ||
| 1541 | + Python/dtoa.o: Python/dtoa.c | ||
| 1542 | + $(CC) -c $(PY_CORE_CFLAGS) $(CFLAGS_ALIASING) -o $@ $< | ||
| 1543 | + | ||
| 1535 | 1544 | # Run reindent on the library | |
| 1536 | 1545 | reindent: | |
| 1537 | 1546 | ./$(BUILDPYTHON) $(srcdir)/Tools/scripts/reindent.py -r $(srcdir)/Lib | |
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
@@ -666,6 +666,7 @@ OTHER_LIBTOOL_OPT | |||
| 666 | 666 | UNIVERSAL_ARCH_FLAGS | |
| 667 | 667 | CFLAGS_NODIST | |
| 668 | 668 | BASECFLAGS | |
| 669 | + CFLAGS_ALIASING | ||
| 669 | 670 | OPT | |
| 670 | 671 | LLVM_PROF_FOUND | |
| 671 | 672 | target_os | |
@@ -6859,6 +6860,7 @@ esac | |||
| 6859 | 6860 | # tweak OPT based on compiler and platform, only if the user didn't set | |
| 6860 | 6861 | # it on the command line | |
| 6861 | 6862 | ||
| 6863 | + | ||
| 6862 | 6864 | if test "${OPT-unset}" = "unset" | |
| 6863 | 6865 | then | |
| 6864 | 6866 | case $GCC in | |
@@ -6871,30 +6873,49 @@ then | |||
| 6871 | 6873 | WRAP="-fwrapv" | |
| 6872 | 6874 | fi | |
| 6873 | 6875 | ||
| 6874 | - # Clang also needs -fwrapv | ||
| 6875 | 6876 | case $CC in | |
| 6876 | - *clang*) WRAP="-fwrapv" | ||
| 6877 | - ;; | ||
| 6877 | + *clang*) | ||
| 6878 | + cc_is_clang=1 | ||
| 6879 | + ;; | ||
| 6880 | + *) | ||
| 6881 | + if $CC --version 2>&1 | grep -q clang | ||
| 6882 | + then | ||
| 6883 | + cc_is_clang=1 | ||
| 6884 | + else | ||
| 6885 | + cc_is_clang= | ||
| 6886 | + fi | ||
| 6878 | 6887 | esac | |
| 6879 | 6888 | ||
| 6889 | + if test -n "${cc_is_clang}" | ||
| 6890 | + then | ||
| 6891 | + # Clang also needs -fwrapv | ||
| 6892 | + WRAP="-fwrapv" | ||
| 6893 | + # bpo-30104: disable strict aliasing to compile correctly dtoa.c, | ||
| 6894 | + # see Makefile.pre.in for more information | ||
| 6895 | + CFLAGS_ALIASING="-fno-strict-aliasing" | ||
| 6896 | + fi | ||
| 6897 | + | ||
| 6880 | 6898 | case $ac_cv_prog_cc_g in | |
| 6881 | 6899 | yes) | |
| 6882 | 6900 | if test "$Py_DEBUG" = 'true' ; then | |
| 6883 | 6901 | # Optimization messes up debuggers, so turn it off for | |
| 6884 | 6902 | # debug builds. | |
| 6885 | 6903 | if "$CC" -v --help 2>/dev/null |grep -- -Og > /dev/null; then | |
| 6886 | - OPT="-g -Og -Wall $STRICT_PROTO" | ||
| 6904 | + OPT="-g -Og -Wall" | ||
| 6887 | 6905 | else | |
| 6888 | - OPT="-g -O0 -Wall $STRICT_PROTO" | ||
| 6906 | + OPT="-g -O0 -Wall" | ||
| 6889 | 6907 | fi | |
| 6890 | 6908 | else | |
| 6891 | - OPT="-g $WRAP -O3 -Wall $STRICT_PROTO" | ||
| 6909 | + OPT="-g $WRAP -O3 -Wall" | ||
| 6892 | 6910 | fi | |
| 6893 | 6911 | ;; | |
| 6894 | 6912 | *) | |
| 6895 | - OPT="-O3 -Wall $STRICT_PROTO" | ||
| 6913 | + OPT="-O3 -Wall" | ||
| 6896 | 6914 | ;; | |
| 6897 | 6915 | esac | |
| 6916 | + | ||
| 6917 | + OPT="$OPT $STRICT_PROTO" | ||
| 6918 | + | ||
| 6898 | 6919 | case $ac_sys_system in | |
| 6899 | 6920 | SCO_SV*) OPT="$OPT -m486 -DSCO5" | |
| 6900 | 6921 | ;; | |
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
@@ -1403,6 +1403,7 @@ esac | |||
| 1403 | 1403 | # tweak OPT based on compiler and platform, only if the user didn't set | |
| 1404 | 1404 | # it on the command line | |
| 1405 | 1405 | AC_SUBST(OPT) | |
| 1406 | + AC_SUBST(CFLAGS_ALIASING) | ||
| 1406 | 1407 | if test "${OPT-unset}" = "unset" | |
| 1407 | 1408 | then | |
| 1408 | 1409 | case $GCC in | |
@@ -1415,30 +1416,49 @@ then | |||
| 1415 | 1416 | WRAP="-fwrapv" | |
| 1416 | 1417 | fi | |
| 1417 | 1418 | ||
| 1418 | - # Clang also needs -fwrapv | ||
| 1419 | 1419 | case $CC in | |
| 1420 | - *clang*) WRAP="-fwrapv" | ||
| 1421 | - ;; | ||
| 1420 | + *clang*) | ||
| 1421 | + cc_is_clang=1 | ||
| 1422 | + ;; | ||
| 1423 | + *) | ||
| 1424 | + if $CC --version 2>&1 | grep -q clang | ||
| 1425 | + then | ||
| 1426 | + cc_is_clang=1 | ||
| 1427 | + else | ||
| 1428 | + cc_is_clang= | ||
| 1429 | + fi | ||
| 1422 | 1430 | esac | |
| 1423 | 1431 | ||
| 1432 | + if test -n "${cc_is_clang}" | ||
| 1433 | + then | ||
| 1434 | + # Clang also needs -fwrapv | ||
| 1435 | + WRAP="-fwrapv" | ||
| 1436 | + # bpo-30104: disable strict aliasing to compile correctly dtoa.c, | ||
| 1437 | + # see Makefile.pre.in for more information | ||
| 1438 | + CFLAGS_ALIASING="-fno-strict-aliasing" | ||
| 1439 | + fi | ||
| 1440 | + | ||
| 1424 | 1441 | case $ac_cv_prog_cc_g in | |
| 1425 | 1442 | yes) | |
| 1426 | 1443 | if test "$Py_DEBUG" = 'true' ; then | |
| 1427 | 1444 | # Optimization messes up debuggers, so turn it off for | |
| 1428 | 1445 | # debug builds. | |
| 1429 | 1446 | if "$CC" -v --help 2>/dev/null |grep -- -Og > /dev/null; then | |
| 1430 | - OPT="-g -Og -Wall $STRICT_PROTO" | ||
| 1447 | + OPT="-g -Og -Wall" | ||
| 1431 | 1448 | else | |
| 1432 | - OPT="-g -O0 -Wall $STRICT_PROTO" | ||
| 1449 | + OPT="-g -O0 -Wall" | ||
| 1433 | 1450 | fi | |
| 1434 | 1451 | else | |
| 1435 | - OPT="-g $WRAP -O3 -Wall $STRICT_PROTO" | ||
| 1452 | + OPT="-g $WRAP -O3 -Wall" | ||
| 1436 | 1453 | fi | |
| 1437 | 1454 | ;; | |
| 1438 | 1455 | *) | |
| 1439 | - OPT="-O3 -Wall $STRICT_PROTO" | ||
| 1456 | + OPT="-O3 -Wall" | ||
| 1440 | 1457 | ;; | |
| 1441 | 1458 | esac | |
| 1459 | + | ||
| 1460 | + OPT="$OPT $STRICT_PROTO" | ||
| 1461 | + | ||
| 1442 | 1462 | case $ac_sys_system in | |
| 1443 | 1463 | SCO_SV*) OPT="$OPT -m486 -DSCO5" | |
| 1444 | 1464 | ;; | |
| Back | FazBrowse Home | New Git URL |
0 commit comments