From patchwork Thu Oct 12 15:27:53 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Jakub Jelinek X-Patchwork-Id: 152036 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a05:612c:2908:b0:403:3b70:6f57 with SMTP id ib8csp1312441vqb; Thu, 12 Oct 2023 08:28:36 -0700 (PDT) X-Google-Smtp-Source: AGHT+IGPxGVcOMwdHyvaAgqsT/iHaveXrgyB8F+EmJdMvhXflYe9nsyrNTWh2uYt1e9HvJRFGL0C X-Received: by 2002:a05:620a:248a:b0:76e:e66c:92f8 with SMTP id i10-20020a05620a248a00b0076ee66c92f8mr34019825qkn.8.1697124516171; Thu, 12 Oct 2023 08:28:36 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1697124516; cv=none; d=google.com; s=arc-20160816; b=t0Oubymi2yBZ/ExHELJWClz+huxLfsHKVMmKgqp+yXRc+FWDwFbKWxfJ2ltIkvHBr4 9LkOWe9uQjdvwGnL/TriHsVIuORXmglJR1OiA5AizychMRFzpLEnJlGXUIoNQQXQKdqO Oi0Uy5+DzgsNjCRDF8BNQvIfe0SSr21rMQDa4cfNB5TZcV2UI0jdEdP9hfAT4u8/KRoj 9CMBDbL+2ygfFw+HAsK8Civp4aZblYoWe/NIKn6bc9epwu0FjFXdBxNPDMTpFttxlIH+ 92UQkPyDY6QfYehdzisjdpBCRt1i+/Ouzs4Vi7h2i7SOcZTSXqjkqm32+9ZdYIylM7tg 8hUw== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=errors-to:reply-to:list-subscribe:list-help:list-post:list-archive :list-unsubscribe:list-id:precedence:content-disposition :mime-version:message-id:subject:cc:to:from:date:dkim-signature :dmarc-filter:delivered-to; bh=cio45VW9qea5HWDU71TVDeNAL6SaJX6tiJcD4ZoDO+Q=; fh=9t12fTY8xtC9iNzH0vP94Eh41bs0vtRWQejWO7/x6pk=; b=dRVTWnHYNHdm2MCY38iT6pl49xC8NLReELUySC/FU/tYt1r8LLwjWtusr46F2Kj/J5 3Cll9+v89g+ao7gYNGnXUlVo7UmpMMACAjrq07J3bmE91SowS8Dxe+epAOHPwesTv3S3 XTLlppikiyll3qNnKWnuXcfQ8CBGyXkif2aiHMjZnA4wrjcO1sAoMG8jNpbUV2rTy/z+ 1lSIzvMkXN7u/C4j53hWgCX1umRMApRRw4kP3ahSYz9fCItp84oAvVJx3sImycaG/e/T kXnCtC0QcaS5YVeqpYa6IsbhS6s/1N+trPlXQ4wit6WjnHbY7koIFfbBwXOx6EZWbnzz 0hvg== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@redhat.com header.s=mimecast20190719 header.b=F6mYXx5B; 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=NONE dis=NONE) header.from=redhat.com Received: from server2.sourceware.org (server2.sourceware.org. [2620:52:3:1:0:246e:9693:128c]) by mx.google.com with ESMTPS id bm42-20020a05620a19aa00b0076cf1fdcd65si11421105qkb.264.2023.10.12.08.28.36 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 12 Oct 2023 08:28:36 -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=@redhat.com header.s=mimecast20190719 header.b=F6mYXx5B; 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=NONE dis=NONE) header.from=redhat.com Received: from server2.sourceware.org (localhost [IPv6:::1]) by sourceware.org (Postfix) with ESMTP id ED3423857BA4 for ; Thu, 12 Oct 2023 15:28:35 +0000 (GMT) X-Original-To: gcc-patches@gcc.gnu.org Delivered-To: gcc-patches@gcc.gnu.org Received: from us-smtp-delivery-124.mimecast.com (us-smtp-delivery-124.mimecast.com [170.10.133.124]) by sourceware.org (Postfix) with ESMTPS id 0A0D43858404 for ; Thu, 12 Oct 2023 15:28:12 +0000 (GMT) DMARC-Filter: OpenDMARC Filter v1.4.2 sourceware.org 0A0D43858404 Authentication-Results: sourceware.org; dmarc=pass (p=none dis=none) header.from=redhat.com Authentication-Results: sourceware.org; spf=pass smtp.mailfrom=redhat.com DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1697124491; h=from:from:reply-to:reply-to:subject:subject:date:date: message-id:message-id:to:to:cc:cc:mime-version:mime-version: content-type:content-type; bh=cio45VW9qea5HWDU71TVDeNAL6SaJX6tiJcD4ZoDO+Q=; b=F6mYXx5Bv2q9bfKZOil/0hduh8Jy5JBE76q6PgtHRB4zkY6M8xjnkBiSr2rEOec9J9DGTd XnA0FZo6ZI2leOr41Sy7M7rar2p3Bp5S7jKEyWv796dHDxMEXzJSvt+Q4xCGKPbEeod30z UsiK4J1sdpNOkZ1Pch8hKAyU0CnnbPs= Received: from mimecast-mx02.redhat.com (mimecast-mx02.redhat.com [66.187.233.88]) by relay.mimecast.com with ESMTP with STARTTLS (version=TLSv1.2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id us-mta-322-0iJdcM4cNzu02XRM8ElYOQ-1; Thu, 12 Oct 2023 11:27:58 -0400 X-MC-Unique: 0iJdcM4cNzu02XRM8ElYOQ-1 Received: from smtp.corp.redhat.com (int-mx09.intmail.prod.int.rdu2.redhat.com [10.11.54.9]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mimecast-mx02.redhat.com (Postfix) with ESMTPS id E216C889063; Thu, 12 Oct 2023 15:27:57 +0000 (UTC) Received: from tucnak.zalov.cz (unknown [10.39.193.202]) by smtp.corp.redhat.com (Postfix) with ESMTPS id 99184492C3B; Thu, 12 Oct 2023 15:27:57 +0000 (UTC) Received: from tucnak.zalov.cz (localhost [127.0.0.1]) by tucnak.zalov.cz (8.17.1/8.17.1) with ESMTPS id 39CFRscm2669835 (version=TLSv1.3 cipher=TLS_AES_256_GCM_SHA384 bits=256 verify=NOT); Thu, 12 Oct 2023 17:27:55 +0200 Received: (from jakub@localhost) by tucnak.zalov.cz (8.17.1/8.17.1/Submit) id 39CFRrXf2669834; Thu, 12 Oct 2023 17:27:53 +0200 Date: Thu, 12 Oct 2023 17:27:53 +0200 From: Jakub Jelinek To: gcc-patches@gcc.gnu.org Cc: Richard Biener , richard.sandiford@arm.com Subject: [committed] wide-int: Fix build with gcc < 12 or clang++ [PR111787] Message-ID: MIME-Version: 1.0 X-Scanned-By: MIMEDefang 3.1 on 10.11.54.9 X-Mimecast-Spam-Score: 0 X-Mimecast-Originator: redhat.com Content-Disposition: inline X-Spam-Status: No, score=-3.4 required=5.0 tests=BAYES_00, DKIMWL_WL_HIGH, DKIM_SIGNED, DKIM_VALID, DKIM_VALID_AU, DKIM_VALID_EF, RCVD_IN_DNSWL_NONE, RCVD_IN_MSPIKE_H3, RCVD_IN_MSPIKE_WL, SPF_HELO_NONE, SPF_NONE, 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: , Reply-To: Jakub Jelinek Errors-To: gcc-patches-bounces+ouuuleilei=gmail.com@gcc.gnu.org X-getmail-retrieved-from-mailbox: INBOX X-GMAIL-THRID: 1779564036713086660 X-GMAIL-MSGID: 1779564036713086660 Hi! While my wide_int patch bootstrapped/regtested fine when I used GCC 12 as system gcc, apparently it doesn't with GCC 11 and older or clang++. For GCC before PR96555 C++ DR1315 implementation the compiler complains about template argument involving template parameters, for clang++ the same + complains about missing needs_write_val_arg static data member in some wi::int_traits specializations. I've so far rebuilt just stage3 gcc subdirectory with this patch and Tobias and William made it with it through stage1. Committed to unbreak build for others. 2023-10-12 Jakub Jelinek PR bootstrap/111787 * tree.h (wi::int_traits ::needs_write_val_arg): New static data member. (int_traits >::needs_write_val_arg): Likewise. (wi::ints_for): Provide separate partial specializations for generic_wide_int > and INL_CONST_PRECISION or that and CONST_PRECISION, rather than using int_traits >::precision_type as the second template argument. * rtl.h (wi::int_traits ::needs_write_val_arg): New static data member. * double-int.h (wi::int_traits ::needs_write_val_arg): Likewise. Jakub --- gcc/tree.h.jj 2023-10-12 16:01:04.000000000 +0200 +++ gcc/tree.h 2023-10-12 16:52:51.977954615 +0200 @@ -6237,6 +6237,7 @@ namespace wi static const enum precision_type precision_type = VAR_PRECISION; static const bool host_dependent_precision = false; static const bool is_sign_extended = false; + static const bool needs_write_val_arg = false; }; template @@ -6262,6 +6263,7 @@ namespace wi = N == ADDR_MAX_PRECISION ? INL_CONST_PRECISION : CONST_PRECISION; static const bool host_dependent_precision = false; static const bool is_sign_extended = true; + static const bool needs_write_val_arg = false; static const unsigned int precision = N; }; @@ -6293,8 +6295,14 @@ namespace wi tree_to_poly_wide_ref to_poly_wide (const_tree); template - struct ints_for >, - int_traits >::precision_type> + struct ints_for >, INL_CONST_PRECISION> + { + typedef generic_wide_int > extended; + static extended zero (const extended &); + }; + + template + struct ints_for >, CONST_PRECISION> { typedef generic_wide_int > extended; static extended zero (const extended &); @@ -6532,8 +6540,15 @@ wi::to_poly_wide (const_tree t) template inline generic_wide_int > wi::ints_for >, - wi::int_traits >::precision_type - >::zero (const extended &x) + wi::INL_CONST_PRECISION>::zero (const extended &x) +{ + return build_zero_cst (TREE_TYPE (x.get_tree ())); +} + +template +inline generic_wide_int > +wi::ints_for >, + wi::CONST_PRECISION>::zero (const extended &x) { return build_zero_cst (TREE_TYPE (x.get_tree ())); } --- gcc/rtl.h.jj 2023-09-29 22:04:44.463012421 +0200 +++ gcc/rtl.h 2023-10-12 16:54:59.915240074 +0200 @@ -2270,6 +2270,7 @@ namespace wi /* This ought to be true, except for the special case that BImode is canonicalized to STORE_FLAG_VALUE, which might be 1. */ static const bool is_sign_extended = false; + static const bool needs_write_val_arg = false; static unsigned int get_precision (const rtx_mode_t &); static wi::storage_ref decompose (HOST_WIDE_INT *, unsigned int, const rtx_mode_t &); --- gcc/double-int.h.jj 2023-10-12 16:01:04.260164202 +0200 +++ gcc/double-int.h 2023-10-12 16:53:41.401292272 +0200 @@ -442,6 +442,7 @@ namespace wi { static const enum precision_type precision_type = INL_CONST_PRECISION; static const bool host_dependent_precision = true; + static const bool needs_write_val_arg = false; static const unsigned int precision = HOST_BITS_PER_DOUBLE_INT; static unsigned int get_precision (const double_int &); static wi::storage_ref decompose (HOST_WIDE_INT *, unsigned int,