From patchwork Wed Dec 14 09:14:31 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: Jakub Jelinek X-Patchwork-Id: 33116 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:adf:e747:0:0:0:0:0 with SMTP id c7csp101078wrn; Wed, 14 Dec 2022 01:15:30 -0800 (PST) X-Google-Smtp-Source: AA0mqf52o9eu5/4MsT8DTCkpvrkzNLPZxlFACEQurcPPVL54U/zQ8so4CgLInc0j1efWJ8+SmJLW X-Received: by 2002:a17:906:647:b0:7ad:d7f9:38b8 with SMTP id t7-20020a170906064700b007add7f938b8mr20214264ejb.57.1671009329964; Wed, 14 Dec 2022 01:15:29 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1671009329; cv=none; d=google.com; s=arc-20160816; b=OIJCWD8VLKIroPqYi+gkKL5QZ3+d9Q+BoRc8+cu2VWz2W+t/GDppirXfj2z9iNTZlV Hjnbg+bSy5WvKNPc3rxxJq7GwhjU5QiKFekS8NKRKGUf/e4z09z8cBPdLbxMmZcrcRFV onP+9Zw1P+2sIgxytsOTyk3tdsLX0ogkdFtqf7Rg6ywMTKbnMaS5OVn3v1kVARJWXmQ0 xP2gpv/oW+d22Wz9o7IyrnqkycRHtd5a8Ykr+KMOSSRsIKCM9DHk9LWzpMwXYnSSMPXi fwS093mhoZ8KCwMI6Aauj1IXt9DypoqHule/l8fqoiUjQKV1B4CQppk9q0QGYFtcOlaq zo2g== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=sender:errors-to:reply-to:from:list-subscribe:list-help:list-post :list-archive:list-unsubscribe:list-id:precedence :content-transfer-encoding:content-disposition:mime-version :message-id:subject:to:date:dmarc-filter:delivered-to:dkim-signature :dkim-filter; bh=E8Il35M1k7lWGbbjPN0OcOsXr1LDveUMSLVvPblCyto=; b=rrEO/XoshC3Y0NERZGiRwRw3MlghlEX9iIZzb5xHD/hEz2iznLhTH5bvPQ42saYiOK cTNmdZW756mXwDJN5TZ6cHFa+0Rk81Az+LaBSb+NzTl5xM4vsjvIBmoO31kHrybffGAx 6N928QbHKCnf88V0iy4njs1+0xbuztHwjiS3HOhk5qkR+ITRyKR3sF75GUXEkRe52RvF w6XHCafj66bFX5sYpU3VBBYx+LIW+J5y6vA9TdKobFRgzAcDb8w7KHPfng0phYmejkvy gMKNk0WvU0epLYTp7LUNW/ZVhDaaCmgvO8DcYW19AU04k+/WzJC16wFpXT3QfIxwg6U2 Scmw== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@gcc.gnu.org header.s=default header.b=Q0nje2Xh; 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=gnu.org Received: from sourceware.org (server2.sourceware.org. [2620:52:3:1:0:246e:9693:128c]) by mx.google.com with ESMTPS id t15-20020a1709067c0f00b007c08000a65esi8445854ejo.756.2022.12.14.01.15.29 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 14 Dec 2022 01:15:29 -0800 (PST) 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=@gcc.gnu.org header.s=default header.b=Q0nje2Xh; 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=gnu.org Received: from server2.sourceware.org (localhost [IPv6:::1]) by sourceware.org (Postfix) with ESMTP id 5EACA383309F for ; Wed, 14 Dec 2022 09:15:28 +0000 (GMT) DKIM-Filter: OpenDKIM Filter v2.11.0 sourceware.org 5EACA383309F DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gcc.gnu.org; s=default; t=1671009328; bh=E8Il35M1k7lWGbbjPN0OcOsXr1LDveUMSLVvPblCyto=; h=Date:To:Subject:List-Id:List-Unsubscribe:List-Archive:List-Post: List-Help:List-Subscribe:From:Reply-To:From; b=Q0nje2XhU17pngLl4+oZczY7madV0vS7ov5zRkz15iP+BQkqw8qK7ewXgk5+I7viz V9GOVB5qOiVvVyBUneUQeaUirxiVFgEUQZ0jdk3faPaAT9Xi+dQuNm0IkCB47bpbP3 px+Vuz2/RCtTetWsWE1T2CgDz6brNdYt2FPvXQ64= 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.129.124]) by sourceware.org (Postfix) with ESMTPS id 70A3A38330A1 for ; Wed, 14 Dec 2022 09:14:39 +0000 (GMT) DMARC-Filter: OpenDMARC Filter v1.4.1 sourceware.org 70A3A38330A1 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-319-8CZaTOx5POqCQYa_TY8lrA-1; Wed, 14 Dec 2022 04:14:37 -0500 X-MC-Unique: 8CZaTOx5POqCQYa_TY8lrA-1 Received: from smtp.corp.redhat.com (int-mx09.intmail.prod.int.rdu2.redhat.com [10.11.54.9]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mimecast-mx02.redhat.com (Postfix) with ESMTPS id 7C24F858F0E; Wed, 14 Dec 2022 09:14:37 +0000 (UTC) Received: from tucnak.zalov.cz (unknown [10.39.195.114]) by smtp.corp.redhat.com (Postfix) with ESMTPS id 3B447492C14; Wed, 14 Dec 2022 09:14:37 +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 2BE9EWw61134144 (version=TLSv1.3 cipher=TLS_AES_256_GCM_SHA384 bits=256 verify=NOT); Wed, 14 Dec 2022 10:14:33 +0100 Received: (from jakub@localhost) by tucnak.zalov.cz (8.17.1/8.17.1/Submit) id 2BE9EWS11134143; Wed, 14 Dec 2022 10:14:32 +0100 Date: Wed, 14 Dec 2022 10:14:31 +0100 To: gcc-rust@gcc.gnu.org, gcc-patches@gcc.gnu.org Subject: [PATCH] rust: Fix up aarch64-linux bootstrap [PR106072] 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.5 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_H2, 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.29 Precedence: list List-Id: Gcc-patches mailing list List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-Patchwork-Original-From: Jakub Jelinek via Gcc-patches From: Jakub Jelinek Reply-To: Jakub Jelinek Errors-To: gcc-patches-bounces+ouuuleilei=gmail.com@gcc.gnu.org Sender: "Gcc-patches" X-getmail-retrieved-from-mailbox: =?utf-8?q?INBOX?= X-GMAIL-THRID: =?utf-8?q?1752180278989744237?= X-GMAIL-MSGID: =?utf-8?q?1752180278989744237?= Hi! Bootstrap fails on aarch64-linux and some other arches with: .../gcc/rust/parse/rust-parse-impl.h: In member function ‘Rust::AST::ClosureParam Rust::Parser::parse_closure_param() [with ManagedTokenSource = Rust::Lexer]’: .../gcc/rust/parse/rust-parse-impl.h:8916:49: error: ‘this’ pointer is null [-Werror=nonnull] The problem is that while say on x86_64-linux the side-effects in the arguments are evaluated from last argument to first, on aarch64-linux it is the other way around, from first to last. The C++ I believe even in C++17 makes the evaluation of those side-effects unordered (indeterminately sequenced with no interleaving), so that is fine. But, when the call in return statement is evaluated from first to last, std::move (pattern) happens before pattern->get_locus () and the former will make pattern (std::unique_ptr) a wrapper object around nullptr, so dereferencing it later to call get_locus () on it is invalid. The following patch fixes that, ok for trunk? 2022-12-14 Jakub Jelinek PR rust/106072 * parse/rust-parse-impl.h (parse_closure_param): Store pattern->get_locus () in a temporary before std::move (pattern) is invoked. Jakub --- gcc/rust/parse/rust-parse-impl.h.jj 2022-12-13 16:50:12.708093521 +0100 +++ gcc/rust/parse/rust-parse-impl.h 2022-12-14 09:50:31.731111932 +0100 @@ -8912,8 +8912,9 @@ Parser::parse_closur } } - return AST::ClosureParam (std::move (pattern), pattern->get_locus (), - std::move (type), std::move (outer_attrs)); + Location loc = pattern->get_locus (); + return AST::ClosureParam (std::move (pattern), loc, std::move (type), + std::move (outer_attrs)); } // Parses a grouped or tuple expression (disambiguates).