From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: by sourceware.org (Postfix, from userid 1643) id 75E28382A2CD; Thu, 27 Oct 2022 07:50:28 +0000 (GMT) DKIM-Filter: OpenDKIM Filter v2.11.0 sourceware.org 75E28382A2CD DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gcc.gnu.org; s=default; t=1666857028; bh=UiH+lF3EXctQlrn/gNz+auM42lalW7/R+q9BxFcRLI8=; h=From:To:Subject:Date:From; b=pHchvGYLQb/WJow1EfEgumTWcBlJ8dSgh4GNysHibXEBM76NPmc9xUR0EuvcYCxSH qaV0OrWpNujUq3kv5oIvV8dtU+U8vx4ylBzCdku1GFSvkio/B+WmESR45mGVqQeDEt FsF29oGDD3ubgKgSIySMzMeBu0+vzL+7jYIvKqq8= Content-Type: text/plain; charset="us-ascii" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit From: Thomas Schwinge To: gcc-cvs@gcc.gnu.org Subject: [gcc/devel/rust/master] parser: Fix ICE in closure parsing X-Act-Checkin: gcc X-Git-Author: Arthur Cohen X-Git-Refname: refs/heads/devel/rust/master X-Git-Oldrev: 0cf743d57fc67d88ecba654be8574ea9a5be40d2 X-Git-Newrev: db4b399c25fd3c37e52c6b8dbdf6bc9c0f1deb6c Message-Id: <20221027075028.75E28382A2CD@sourceware.org> Date: Thu, 27 Oct 2022 07:50:28 +0000 (GMT) List-Id: https://gcc.gnu.org/g:db4b399c25fd3c37e52c6b8dbdf6bc9c0f1deb6c commit db4b399c25fd3c37e52c6b8dbdf6bc9c0f1deb6c Author: Arthur Cohen Date: Wed Oct 26 11:25:42 2022 +0200 parser: Fix ICE in closure parsing `pattern` is a `unique_ptr`, which should be set to NULL once `std::move`d, hence causing the ICE as we were dereferencing a NULL pointer to get its location. Diff: --- gcc/rust/parse/rust-parse-impl.h | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/gcc/rust/parse/rust-parse-impl.h b/gcc/rust/parse/rust-parse-impl.h index 4ebdcf04f14..54f3c5c25a6 100644 --- a/gcc/rust/parse/rust-parse-impl.h +++ b/gcc/rust/parse/rust-parse-impl.h @@ -8903,8 +8903,9 @@ Parser::parse_closure_param () } } - return AST::ClosureParam (std::move (pattern), pattern->get_locus (), - std::move (type), std::move (outer_attrs)); + auto locus = pattern->get_locus (); + return AST::ClosureParam (std::move (pattern), locus, std::move (type), + std::move (outer_attrs)); } // Parses a grouped or tuple expression (disambiguates).