From patchwork Sat Sep 30 20:49:10 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: Sergei Trofimovich X-Patchwork-Id: 1841643 Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@legolas.ozlabs.org Authentication-Results: legolas.ozlabs.org; dkim=pass (2048-bit key; unprotected) header.d=gmail.com header.i=@gmail.com header.a=rsa-sha256 header.s=20230601 header.b=ARKLtiz6; dkim-atps=neutral Authentication-Results: legolas.ozlabs.org; spf=pass (sender SPF authorized) smtp.mailfrom=gcc.gnu.org (client-ip=2620:52:3:1:0:246e:9693:128c; helo=server2.sourceware.org; envelope-from=gcc-patches-bounces+incoming=patchwork.ozlabs.org@gcc.gnu.org; receiver=patchwork.ozlabs.org) Received: from server2.sourceware.org (server2.sourceware.org [IPv6:2620:52:3:1:0:246e:9693:128c]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature ECDSA (secp384r1) server-digest SHA384) (No client certificate requested) by legolas.ozlabs.org (Postfix) with ESMTPS id 4RyfTs2S4Pz1yp7 for ; Sun, 1 Oct 2023 07:49:36 +1100 (AEDT) Received: from server2.sourceware.org (localhost [IPv6:::1]) by sourceware.org (Postfix) with ESMTP id 597E83856243 for ; Sat, 30 Sep 2023 20:49:34 +0000 (GMT) X-Original-To: gcc-patches@gcc.gnu.org Delivered-To: gcc-patches@gcc.gnu.org Received: from mail-wm1-x334.google.com (mail-wm1-x334.google.com [IPv6:2a00:1450:4864:20::334]) by sourceware.org (Postfix) with ESMTPS id A66CF3858C5F for ; Sat, 30 Sep 2023 20:49:22 +0000 (GMT) DMARC-Filter: OpenDMARC Filter v1.4.2 sourceware.org A66CF3858C5F Authentication-Results: sourceware.org; dmarc=pass (p=none dis=none) header.from=gmail.com Authentication-Results: sourceware.org; spf=pass smtp.mailfrom=gmail.com Received: by mail-wm1-x334.google.com with SMTP id 5b1f17b1804b1-40666aa674fso6281705e9.0 for ; Sat, 30 Sep 2023 13:49:22 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20230601; t=1696106961; x=1696711761; darn=gcc.gnu.org; h=content-transfer-encoding:mime-version:message-id:date:subject:cc :to:from:from:to:cc:subject:date:message-id:reply-to; bh=s5FoobwYgr+Dy9GV+bPFYPUDExCO5Ri54op+BOP+BwI=; b=ARKLtiz68JZ1vhUpFjAHmAoojWDjolIU2ju196ipEoqdro50we2b2TmIblvJm0bwAB 63bppHoSzB1ZggOTWKTm2gQxth7LIV3a3p1BME+FdlUP0wb7R9Qnw7R2rOXSji0afWed NfyakuhQxvWANTiOhfp6HI98ogEJO9oo3TiZzlXiQck0FhdIvv1vNl51rNDIHu8TSYhw yWR0Dy/43GaCa2JDbxDoFB31Okcc12miiuIVvp2vbDkrW5h89IHV7Ul6deUIpCCgcfqP EoV6PVOlLaeaw9WMlP6SXz8ke1VXzgAcaS19fEetSBQxdEReTZcvzaumX8tvKyY1pjzT DREw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1696106961; x=1696711761; h=content-transfer-encoding:mime-version:message-id:date:subject:cc :to:from:x-gm-message-state:from:to:cc:subject:date:message-id :reply-to; bh=s5FoobwYgr+Dy9GV+bPFYPUDExCO5Ri54op+BOP+BwI=; b=eBrh0rlQLb8FLNs0H3p5u025M/CHbrpNSxEOpWnzoU7ME0m8slcG2izXopBeWclNWh PFsPUL8/I2rzRaLBAlLN8sJybCSVhvj67DAUbCLJ09FY6jgK9bSab5jE6v/ag2eYa3SP h2/lgnRbbdf7ZKVVuABNLX4DngApYtcwXSVts2X6YWhNiSZjF4tNnOkG+KM+M3k/mLNz UuW9cp8QVYhLzkAimNkIocLGGScpkIWCZGXdePpGCLKVJrCrsuMgR1SsLv6pQTLR7zgZ 8m747cpnsiNFMkC+fEjsBk9UGYcY8RMGTFCdfowPAyTa00vhqvX+QB/XWMXv6PtToiqq rLlA== X-Gm-Message-State: AOJu0Yy7QcFnNshAs9Eef/4x2BAvmNVKFU93DmY2wmjy6cvks0VQ98N4 vEaAbAcH2Cq1yTAGGUGJcsw= X-Google-Smtp-Source: AGHT+IEn7ImI9QnQp6BpxLs4CtQgfwiREBI9z1cqvEvrgWNHcGH0xXc6HY0dpLXEFDjCE4PYSy3wMg== X-Received: by 2002:a5d:46cc:0:b0:31f:8999:c409 with SMTP id g12-20020a5d46cc000000b0031f8999c409mr6584459wrs.66.1696106961070; Sat, 30 Sep 2023 13:49:21 -0700 (PDT) Received: from nz.home (host86-139-202-110.range86-139.btcentralplus.com. [86.139.202.110]) by smtp.gmail.com with ESMTPSA id x5-20020adfdcc5000000b0031c6581d55esm24660748wrm.91.2023.09.30.13.49.20 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Sat, 30 Sep 2023 13:49:20 -0700 (PDT) Received: by nz.home (Postfix, from userid 1000) id 1B078112538C4A; Sat, 30 Sep 2023 21:49:20 +0100 (BST) From: Sergei Trofimovich To: gcc-patches@gcc.gnu.org, Richard Sandiford , Jakub Jelinek Cc: Sergei Trofimovich , Sergei Trofimovich Subject: [PATCH] rtl: fix buidl failure on -fchecking=2 [PR111642] Date: Sat, 30 Sep 2023 21:49:10 +0100 Message-ID: <20230930204910.3544331-1-slyich@gmail.com> X-Mailer: git-send-email 2.42.0 MIME-Version: 1.0 X-Spam-Status: No, score=-11.6 required=5.0 tests=BAYES_00, DKIM_SIGNED, DKIM_VALID, DKIM_VALID_AU, DKIM_VALID_EF, FREEMAIL_FROM, GIT_PATCH_0, KAM_SHORT, RCVD_IN_DNSWL_NONE, SPF_HELO_NONE, SPF_PASS, TXREP autolearn=ham autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on server2.sourceware.org X-BeenThere: gcc-patches@gcc.gnu.org X-Mailman-Version: 2.1.30 Precedence: list List-Id: Gcc-patches mailing list List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: gcc-patches-bounces+incoming=patchwork.ozlabs.org@gcc.gnu.org From: Sergei Trofimovich 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 -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 -void -const_poly_int_tests::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::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::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::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 -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 void -simplify_const_poly_int_tests::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::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::run (); + simplify_const_poly_int_tests (); } } // namespace selftest