Bug 1377550 Add -d2UndefIntOverflow- flag to disable dangerous optimizations draft
authorTom Ritter <tom@mozilla.com>
Fri, 30 Jun 2017 14:04:08 -0700
changeset 602841 a37fc0addd24a8d36953fe4d8eb17e6692618b8a
parent 601524 217b7fcf58944f927118b465769faeb1e613130a
child 635738 68ff6aed58d83f74c743537006632cee8019f4f8
push id66576
push userbmo:tom@mozilla.com
push dateFri, 30 Jun 2017 21:04:27 +0000
bugs1377550
milestone56.0a1
Bug 1377550 Add -d2UndefIntOverflow- flag to disable dangerous optimizations MozReview-Commit-ID: BHGGMD9qnqR
js/src/old-configure.in
old-configure.in
--- a/js/src/old-configure.in
+++ b/js/src/old-configure.in
@@ -179,16 +179,19 @@ case "$target" in
         AC_DEFINE(_USE_MATH_DEFINES) # Otherwise MSVC's math.h doesn't #define M_PI.
 
         case "$CC_VERSION" in
         19*)
             _CC_SUITE=14
             MSVC_C_RUNTIME_DLL=vcruntime140.dll
             MSVC_CXX_RUNTIME_DLL=msvcp140.dll
 
+            # Disable optimizations that remove code that 'can't be reached' (because of undefined behavior)
+            CXXFLAGS="$CXXFLAGS -d2UndefIntOverflow-"
+
             # C5026: move constructor was implicitly defined as deleted
             CXXFLAGS="$CXXFLAGS -wd5026"
 
             # C5027: move assignment operator was implicitly defined as deleted
             CXXFLAGS="$CXXFLAGS -wd5027"
 
             # -Zc:sizedDealloc- disables C++14 global sized deallocation (see bug 1160146)
             CXXFLAGS="$CXXFLAGS -Zc:sizedDealloc-"
--- a/old-configure.in
+++ b/old-configure.in
@@ -241,16 +241,19 @@ case "$target" in
             MSVC_C_RUNTIME_DLL=vcruntime140.dll
             MSVC_CXX_RUNTIME_DLL=msvcp140.dll
 
             MOZ_CHECK_HEADER(dia2.h, MSVC_HAS_DIA_SDK=1)
             if test -n "$MSVC_HAS_DIA_SDK"; then
                 AC_DEFINE(MSVC_HAS_DIA_SDK)
             fi
 
+            # Disable optimizations that remove code that 'can't be reached' (because of undefined behavior)
+            CXXFLAGS="$CXXFLAGS -d2UndefIntOverflow-"
+
             # C5026: move constructor was implicitly defined as deleted
             CXXFLAGS="$CXXFLAGS -wd5026"
 
             # C5027: move assignment operator was implicitly defined as deleted
             CXXFLAGS="$CXXFLAGS -wd5027"
 
             # -Zc:sizedDealloc- disables C++14 global sized deallocation (see bug 1160146)
             CXXFLAGS="$CXXFLAGS -Zc:sizedDealloc-"