diff options
Diffstat (limited to 'gcc/configure')
-rwxr-xr-x | gcc/configure | 41 |
1 files changed, 39 insertions, 2 deletions
diff --git a/gcc/configure b/gcc/configure index ff646e8fcac..2798231bbd1 100755 --- a/gcc/configure +++ b/gcc/configure @@ -6534,6 +6534,43 @@ fi rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext fi +# Check if C++ __builtin_constant_p works properly. Without the fix +# for PR 65656, g++ miscompiles __builtin_constant_p in wi::lrshift in +# wide-int.h. Add a check with PR 65656 testcase to verify that C++ +# __builtin_constant_p works properly. +if test "$GCC" = yes; then + saved_CFLAGS="$CFLAGS" + saved_CXXFLAGS="$CXXFLAGS" + CFLAGS="$CFLAGS -O -x c++ -std=c++11" + CXXFLAGS="$CXXFLAGS -O -x c++ -std=c++11" + { $as_echo "$as_me:${as_lineno-$LINENO}: checking whether $CXX __builtin_constant_p works with constexpr" >&5 +$as_echo_n "checking whether $CXX __builtin_constant_p works with constexpr... " >&6; } + cat confdefs.h - <<_ACEOF >conftest.$ac_ext +/* end confdefs.h. */ + +int +foo (int argc) +{ + constexpr bool x = __builtin_constant_p(argc); + return x ? 1 : 0; +} + +_ACEOF +if ac_fn_cxx_try_compile "$LINENO"; then : + { $as_echo "$as_me:${as_lineno-$LINENO}: result: yes" >&5 +$as_echo "yes" >&6; } + +$as_echo "#define HAVE_WORKING_CXX_BUILTIN_CONSTANT_P 1" >>confdefs.h + +else + { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 +$as_echo "no" >&6; } +fi +rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext + CFLAGS="$saved_CFLAGS" + CXXFLAGS="$saved_CXXFLAGS" +fi + # Check whether compiler is affected by placement new aliasing bug (PR 29286). # If the host compiler is affected by the bug, and we build with optimization # enabled (which happens e.g. when cross-compiling), the pool allocator may @@ -18419,7 +18456,7 @@ else lt_dlunknown=0; lt_dlno_uscore=1; lt_dlneed_uscore=2 lt_status=$lt_dlunknown cat > conftest.$ac_ext <<_LT_EOF -#line 18422 "configure" +#line 18459 "configure" #include "confdefs.h" #if HAVE_DLFCN_H @@ -18525,7 +18562,7 @@ else lt_dlunknown=0; lt_dlno_uscore=1; lt_dlneed_uscore=2 lt_status=$lt_dlunknown cat > conftest.$ac_ext <<_LT_EOF -#line 18528 "configure" +#line 18565 "configure" #include "confdefs.h" #if HAVE_DLFCN_H |