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: 1841644 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=PXIxhNc0; 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 4Ryfp30Y91z1yp7 for ; Sun, 1 Oct 2023 08:03:37 +1100 (AEDT) Received: from server2.sourceware.org (localhost [IPv6:::1]) by sourceware.org (Postfix) with ESMTP id 0665F385B534 for ; Sat, 30 Sep 2023 21:03:35 +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-Google-Smtp-Source: AGHT+IFq5n/LnSfjoVBLCDn8zIdlJxVld1VE8ElxKiAomrUdDXBLMtJV+t98QzbeDKKm43DNO1faVA== 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+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 | 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