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: 146979 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a05:612c:2a8e:b0:403:3b70:6f57 with SMTP id in14csp572096vqb; Sat, 30 Sep 2023 13:49:51 -0700 (PDT) X-Google-Smtp-Source: AGHT+IEk9DR2t+OL8CfW5FyB7vG332PD+PkbvxlNRAXhjqmEAJfahAr0oTiNSUpyKymypF4HuY9j X-Received: by 2002:a17:906:53d9:b0:9ae:40d1:999b with SMTP id p25-20020a17090653d900b009ae40d1999bmr7954685ejo.16.1696106991052; Sat, 30 Sep 2023 13:49:51 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1696106991; cv=none; d=google.com; s=arc-20160816; b=Nu+bieR99ddUF/rSK1snS/SotQG7WwkhGF+xeT2T0vzuGtGD5n1XExfwF1wxz65SHL sEz65hLvMdZ9NOGXasXOSMRqYxq3K8ctY2xewyRMEeaxVihC6wBsP3U+Y3qn5+wthFOv sd+JM3KMF6DeBQn85cgh21WI0Q1mKDA6dx4G0sSjK3/y4WeHN0rhtELJF3+xVKAo2cJT 7geUDL9sQ+FHu6fxg+PG+nt89lKDE0xQB6RspXeVbPau7bLP2rfwqWGPT7qeI5Li0oZP 00op+FvE8dTlxSzwicgE7jLB6cHf4+vO8euS+Mv+VMFA8RaZvvvTXVDRHupaNrbVSgJ6 Rp2Q== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=errors-to:list-subscribe:list-help:list-post:list-archive :list-unsubscribe:list-id:precedence:content-transfer-encoding :mime-version:message-id:date:subject:cc:to:from:dkim-signature :dmarc-filter:delivered-to; bh=s5FoobwYgr+Dy9GV+bPFYPUDExCO5Ri54op+BOP+BwI=; fh=UsE2/pl4qX5p3oAvWA71GB20Vdey73U0V5grtq6AqFE=; b=RIzR8hOsqALFflqy6QbUhiv1xngRhkimYL5F2RUCVgmb9ag1SIYwb0+nTEnanhbJLn I3yqGPnVQQ7Hret0FJnRLBegqo3WFiuco+DcJgMazr7YTpyIInjPkt7ZKUXIXNAnMvZ8 KfjGc2kIU4ZOpfs6sl9xRiLA3c18Inq4S0ZpHJeK4rJHupkRamikkhj/igDRTqiw/zjg GEU9Jt1k/VW00DHelbiGlsO8rWaC7p7zaBVk8JmxMFMCntyDd8K2tmyyy2WIvHomVbia gFajNLpSJi+5yGg0fN2AoQmUqSrag5VOcvYvMS1NW74XV+8qITDXgs80qAHQ7Sy9AB3q OGUg== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@gmail.com header.s=20230601 header.b=ARKLtiz6; spf=pass (google.com: domain of gcc-patches-bounces+ouuuleilei=gmail.com@gcc.gnu.org designates 2620:52:3:1:0:246e:9693:128c as permitted sender) smtp.mailfrom="gcc-patches-bounces+ouuuleilei=gmail.com@gcc.gnu.org"; dmarc=pass (p=NONE sp=QUARANTINE dis=NONE) header.from=gmail.com Received: from server2.sourceware.org (server2.sourceware.org. [2620:52:3:1:0:246e:9693:128c]) by mx.google.com with ESMTPS id t7-20020a1709067c0700b009b2d351cc66si1807619ejo.666.2023.09.30.13.49.50 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Sat, 30 Sep 2023 13:49:51 -0700 (PDT) Received-SPF: pass (google.com: domain of gcc-patches-bounces+ouuuleilei=gmail.com@gcc.gnu.org designates 2620:52:3:1:0:246e:9693:128c as permitted sender) client-ip=2620:52:3:1:0:246e:9693:128c; Authentication-Results: mx.google.com; dkim=pass header.i=@gmail.com header.s=20230601 header.b=ARKLtiz6; spf=pass (google.com: domain of gcc-patches-bounces+ouuuleilei=gmail.com@gcc.gnu.org designates 2620:52:3:1:0:246e:9693:128c as permitted sender) smtp.mailfrom="gcc-patches-bounces+ouuuleilei=gmail.com@gcc.gnu.org"; dmarc=pass (p=NONE sp=QUARANTINE dis=NONE) header.from=gmail.com Received: from server2.sourceware.org (localhost [IPv6:::1]) by sourceware.org (Postfix) with ESMTP id 67ED23856DDF for ; Sat, 30 Sep 2023 20:49:46 +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-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+ouuuleilei=gmail.com@gcc.gnu.org X-getmail-retrieved-from-mailbox: INBOX X-GMAIL-THRID: 1778497084060056195 X-GMAIL-MSGID: 1778497084060056195 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