From patchwork Sat Sep 30 21:02:54 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: Sergei Trofimovich X-Patchwork-Id: 146981 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a05:612c:2a8e:b0:403:3b70:6f57 with SMTP id in14csp576607vqb; Sat, 30 Sep 2023 14:03:57 -0700 (PDT) X-Google-Smtp-Source: AGHT+IGy93/sfRRa8BzL5Rbut+VQAUCNcUFDt6NDWxiTldm4/mzo2BD2JbAy3/8tg4M5NWgV+7nD X-Received: by 2002:a17:906:34c5:b0:9a1:be5b:f4aa with SMTP id h5-20020a17090634c500b009a1be5bf4aamr6724483ejb.0.1696107837236; Sat, 30 Sep 2023 14:03:57 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1696107837; cv=none; d=google.com; s=arc-20160816; b=GafhEyDxmywsVPtSDKM4Ayrr80oQ/862xdWmh7wpgKa0xbD99BvhARJ4K3RqBI8y4w OClNH90+Bzkd+WfGqZ4y3mX1GYamoByGXiK/lD6SusMwywkvRT5q/ZkNvJSn9XGTp8fT VMJIKZD/qaE4DPQ/8RlGgjfDIQaVjTyfUBUm5wmfE8Wa9POVPG8Lx8Kf8Uv8A4XlFFL4 V75A2lM1+/j7+teVUkRPJ2m2hkTUJyxTCHgPljqJdhtQZdKyOZfTQoEWxHIp1aRoQ1Xv qAuE/Ou7AG8n774im70RPuKuYqBEyOmGy5K5V/nlgF/S6AZ6aOWWz3qG/FDGOTnG5w3+ zGjw== 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:references:in-reply-to:message-id:date:subject:cc:to :from:dkim-signature:dmarc-filter:delivered-to; bh=1ZAUosgZmt9hdT1qH4lGxB2FlqLOWkx2iSH5EDYmm+E=; fh=YPwcrKVXTo2EwD1cLHnD/9hjiw7rbhRWHRHd7E+GZYs=; b=YH5SX+hlTADifGf43GsfZlWWQHLM1guH7zWhOucCfSSfWPHtTxeCbNZV/8aIZbbuqE /RGykDE6C3DyzAyIM6AIR3pJpYlujd7F/lzU6kX9/aSmnTn4/vcCQVJQIO6bmxJJtKmI NIwrXjtO8Su3oGd9W8TRvri+naVEUMF8Pc3MzfeG9C09GV633dsNRorahXVoi08F5qQS GjEvdjaKH2Zh2/f3ugct7EP93KWk6So5CT0tlGavvs7DcQPDQHWLelSBLRla9zAg/6PD h9K+0GhaV7ZoA1sCdWogUdVoRe8HrqDq3UnGEEqlkgvDe88E/7Nd00X8A6D9q0UPfm6T hTYg== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@gmail.com header.s=20230601 header.b=PXIxhNc0; 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 w11-20020a50fa8b000000b00536029282fasi4217408edr.46.2023.09.30.14.03.56 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Sat, 30 Sep 2023 14:03:57 -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=PXIxhNc0; 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 4785738319D8 for ; Sat, 30 Sep 2023 21:03:47 +0000 (GMT) X-Original-To: gcc-patches@gcc.gnu.org Delivered-To: gcc-patches@gcc.gnu.org Received: from mail-wm1-x32c.google.com (mail-wm1-x32c.google.com [IPv6:2a00:1450:4864:20::32c]) by sourceware.org (Postfix) with ESMTPS id 15C1C3858C2F for ; Sat, 30 Sep 2023 21:03:22 +0000 (GMT) DMARC-Filter: OpenDMARC Filter v1.4.2 sourceware.org 15C1C3858C2F 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-x32c.google.com with SMTP id 5b1f17b1804b1-40652e5718cso29632265e9.3 for ; Sat, 30 Sep 2023 14:03:22 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20230601; t=1696107800; x=1696712600; darn=gcc.gnu.org; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:from:to:cc:subject:date :message-id:reply-to; bh=1ZAUosgZmt9hdT1qH4lGxB2FlqLOWkx2iSH5EDYmm+E=; b=PXIxhNc00kMiq4wotHAC8WbxDwjM8W4+6juIBTb/uG2cGlvlkXrabrXY0Lc9O0lrZt 1/QDo2JjiG/+m6dhoo/Os3HhpKbomD7mvRnZq0LOkeFJ0VKC1GXL0MMwfTnKz6EyKSxB VsTOEeQz6MdbUVeBmzV/wMh2Ub32oED6haNBQF/AwTJefgET+vAfvrtRgfFRhc4erLqY HbUggrEynndpO88QKddAqyUhgao8hED0fFScZP1PRoGvg/DNZjqkhdm5Pg7QWcVU1ThJ sfNvOJFoSdEcALm7Lwl7s2O0YZMTQDRGt2+sVYRQ9XFTQOs37T/8w0F34WwzMnTs1ecW /9Xg== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1696107800; x=1696712600; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=1ZAUosgZmt9hdT1qH4lGxB2FlqLOWkx2iSH5EDYmm+E=; b=sFHrElKh1MLgTVcehiblylUpTHZEVCD9xP0WBazUpNC/tn6k5j1Njf5ilfYtrsX8yb JUD4fZsX9r6/vwQ1+V6vWBEyPazpkAiPOfztfVmp86E3pHBvtfJvVNHMoyCnlh9phREe Xddbt7WFENZ0hwzrtuJyRnm03B80CI3CE7J4xX4q78U4yzZQaFK3Htc1d4xs72QLkovh TguOYuUIjcuMm87PW55Q459V+kCsmZS1D/eIhdOL+3f/Ba1SCJ/wbsgS72FjSbSIlul9 xek3ilv5ipsJFzt7RQcAf7uTCfVzIpy68TRIMATyAW9+MiXQshQfaJGQivxsRClTQ/qS UWuA== X-Gm-Message-State: AOJu0YyDmhswIWO8ZFV+BHCnedoNFIGYu3jX+84qovoHbW1yFYHqaSzA awqsOYeHIJGxqvSM92wkBYE= X-Received: by 2002:a05:600c:211:b0:404:6ed9:98d1 with SMTP id 17-20020a05600c021100b004046ed998d1mr6630082wmi.41.1696107800231; Sat, 30 Sep 2023 14:03:20 -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 l5-20020a7bc445000000b003fbe791a0e8sm4118640wmi.0.2023.09.30.14.03.19 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Sat, 30 Sep 2023 14:03:19 -0700 (PDT) Received: by nz.home (Postfix, from userid 1000) id 664301125428DC; Sat, 30 Sep 2023 22:03:19 +0100 (BST) From: Sergei Trofimovich To: gcc-patches@gcc.gnu.org, Richard Sandiford , Jakub Jelinek , Andreas Schwab Cc: Sergei Trofimovich , Sergei Trofimovich Subject: [PATCH v2] rtl: fix build failure on -fchecking=2 [PR111642] Date: Sat, 30 Sep 2023 22:02:54 +0100 Message-ID: <20230930210254.3750973-1-slyich@gmail.com> X-Mailer: git-send-email 2.42.0 In-Reply-To: <87a5t3fkq9.fsf@igel.home> References: <87a5t3fkq9.fsf@igel.home> 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: 1778497971570014404 X-GMAIL-MSGID: 1778497971570014404 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 | 23 +++++++---------------- gcc/simplify-rtx.cc | 21 ++++++--------------- 2 files changed, 13 insertions(+), 31 deletions(-) diff --git a/gcc/rtl-tests.cc b/gcc/rtl-tests.cc index ae8669419b6..d4130572501 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); @@ -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