From: Sergei Trofimovich <siarh...@google.com> Before the change `make bootstrap4` (or `make profiledbootstrap`) failed as:
gcc/rtl-tests.cc:249:25: in ‘constexpr’ expansion of ‘poly_int<1, long int>(1, 1)’ gcc/poly-int.h:453:5: error: too many initializers for ‘long int [1]’ The failure happened only in stage4 due to a gcc bug which accepts invalid C++ without `-fchecking=2`: https://gcc.gnu.org/PR111647#c1. The change hides tests that rely on 2 and more polynomials under `#if`. gcc/ PR bootstrap/111642 * rtl-tests.cc (const_poly_int_tests): Guard tests with NUM_POLY_INT_COEFFS > 1. * simplify-rtx.cc (simplify_const_poly_int_tests): Ditto. --- gcc/rtl-tests.cc | 25 ++++++++----------------- gcc/simplify-rtx.cc | 21 ++++++--------------- 2 files changed, 14 insertions(+), 32 deletions(-) diff --git a/gcc/rtl-tests.cc b/gcc/rtl-tests.cc index ae8669419b6..85c1e56048d 100644 --- a/gcc/rtl-tests.cc +++ b/gcc/rtl-tests.cc @@ -228,24 +228,14 @@ test_uncond_jump () jump_insn); } -template<unsigned int N> -struct const_poly_int_tests -{ - static void run (); -}; - -template<> -struct const_poly_int_tests<1> -{ - static void run () {} -}; - /* Test various CONST_POLY_INT properties. */ -template<unsigned int N> -void -const_poly_int_tests<N>::run () +static void +const_poly_int_tests () { + /* `poly_int64` call with two parameters requires target with at + least 2 COEFFs. */ +#if NUM_POLY_INT_COEFFS > 1 rtx x1 = gen_int_mode (poly_int64 (1, 1), QImode); rtx x255 = gen_int_mode (poly_int64 (1, 255), QImode); @@ -263,7 +253,7 @@ const_poly_int_tests<N>::run () ASSERT_KNOWN_EQ (rtx_to_poly_int64 (x255), poly_int64 (1, -1)); ASSERT_MAYBE_NE (rtx_to_poly_int64 (x255), poly_int64 (1, 255)); - /* Test plus_constant of a symbol. */ + /* Test plus_consctant of a symbol. */ rtx symbol = gen_rtx_SYMBOL_REF (Pmode, "foo"); rtx offset1 = gen_int_mode (poly_int64 (9, 11), Pmode); rtx sum1 = gen_rtx_CONST (Pmode, gen_rtx_PLUS (Pmode, symbol, offset1)); @@ -282,6 +272,7 @@ const_poly_int_tests<N>::run () gen_int_mode (poly_int64 (5, -2), QImode)); ASSERT_EQ (plus_constant (QImode, x1, poly_int64 (4, -2)), gen_int_mode (poly_int64 (5, -1), QImode)); +#endif } /* Check dumping of repeated RTL vectors. */ @@ -317,7 +308,7 @@ rtl_tests_cc_tests () test_dumping_rtx_reuse (); test_single_set (); test_uncond_jump (); - const_poly_int_tests<NUM_POLY_INT_COEFFS>::run (); + const_poly_int_tests (); test_dumping_repeat (); /* Purge state. */ diff --git a/gcc/simplify-rtx.cc b/gcc/simplify-rtx.cc index 170406aa28b..39361b11b1a 100644 --- a/gcc/simplify-rtx.cc +++ b/gcc/simplify-rtx.cc @@ -8671,24 +8671,14 @@ test_vector_ops () } } -template<unsigned int N> -struct simplify_const_poly_int_tests -{ - static void run (); -}; - -template<> -struct simplify_const_poly_int_tests<1> -{ - static void run () {} -}; - /* Test various CONST_POLY_INT properties. */ -template<unsigned int N> void -simplify_const_poly_int_tests<N>::run () +simplify_const_poly_int_tests () { + /* `poly_int64` call with two parameters requires target with at + least 2 COEFFs. */ +#if NUM_POLY_INT_COEFFS > 1 rtx x1 = gen_int_mode (poly_int64 (1, 1), QImode); rtx x2 = gen_int_mode (poly_int64 (-80, 127), QImode); rtx x3 = gen_int_mode (poly_int64 (-79, -128), QImode); @@ -8716,6 +8706,7 @@ simplify_const_poly_int_tests<N>::run () ASSERT_EQ (simplify_binary_operation (IOR, QImode, x4, two), x7); ASSERT_EQ (simplify_subreg (HImode, x5, QImode, 0), x8); ASSERT_EQ (simplify_subreg (QImode, x8, HImode, offset), x5); +#endif } /* Run all of the selftests within this file. */ @@ -8725,7 +8716,7 @@ simplify_rtx_cc_tests () { test_scalar_ops (); test_vector_ops (); - simplify_const_poly_int_tests<NUM_POLY_INT_COEFFS>::run (); + simplify_const_poly_int_tests (); } } // namespace selftest -- 2.42.0