1.1 --- /dev/null Thu Jan 01 00:00:00 1970 +0000 1.2 +++ b/build/autoconf/gcc-pr49911.m4 Wed Dec 31 06:09:35 2014 +0100 1.3 @@ -0,0 +1,71 @@ 1.4 +dnl This Source Code Form is subject to the terms of the Mozilla Public 1.5 +dnl License, v. 2.0. If a copy of the MPL was not distributed with this 1.6 +dnl file, You can obtain one at http://mozilla.org/MPL/2.0/. 1.7 + 1.8 +dnl Check if the compiler is gcc and has PR49911. If so 1.9 +dnl disable vrp. 1.10 + 1.11 +AC_DEFUN([MOZ_GCC_PR49911], 1.12 +[ 1.13 +if test "$GNU_CC"; then 1.14 + 1.15 +AC_MSG_CHECKING(for gcc PR49911) 1.16 +ac_have_gcc_pr49911="no" 1.17 +AC_LANG_SAVE 1.18 +AC_LANG_CPLUSPLUS 1.19 + 1.20 +_SAVE_CXXFLAGS=$CXXFLAGS 1.21 +CXXFLAGS="-O2" 1.22 +AC_TRY_RUN([ 1.23 +extern "C" void abort(void); 1.24 +typedef enum { 1.25 +eax, ecx, edx, ebx, esp, ebp, 1.26 +esi, edi } 1.27 +RegisterID; 1.28 +union StateRemat { 1.29 + RegisterID reg_; 1.30 + int offset_; 1.31 +}; 1.32 +static StateRemat FromRegister(RegisterID reg) { 1.33 + StateRemat sr; 1.34 + sr.reg_ = reg; 1.35 + return sr; 1.36 +} 1.37 +static StateRemat FromAddress3(int address) { 1.38 + StateRemat sr; 1.39 + sr.offset_ = address; 1.40 + if (address < 46 && address >= 0) { 1.41 + abort(); 1.42 + } 1.43 + return sr; 1.44 +} 1.45 +struct FrameState { 1.46 + StateRemat dataRematInfo2(bool y, int z) { 1.47 + if (y) return FromRegister(RegisterID(1)); 1.48 + return FromAddress3(z); 1.49 + } 1.50 +}; 1.51 +FrameState frame; 1.52 +StateRemat x; 1.53 +__attribute__((noinline)) void jsop_setelem(bool y, int z) { 1.54 + x = frame.dataRematInfo2(y, z); 1.55 +} 1.56 +int main(void) { 1.57 + jsop_setelem(0, 47); 1.58 +} 1.59 +], true, 1.60 + ac_have_gcc_pr49911="yes", 1.61 + true) 1.62 +CXXFLAGS="$_SAVE_CXXFLAGS" 1.63 + 1.64 +AC_LANG_RESTORE 1.65 + 1.66 +if test "$ac_have_gcc_pr49911" = "yes"; then 1.67 + AC_MSG_RESULT(yes) 1.68 + CFLAGS="$CFLAGS -fno-tree-vrp" 1.69 + CXXFLAGS="$CXXFLAGS -fno-tree-vrp" 1.70 +else 1.71 + AC_MSG_RESULT(no) 1.72 +fi 1.73 +fi 1.74 +])