public inbox for gcc-cvs@sourceware.org
help / color / mirror / Atom feed
From: Thomas Schwinge <tschwinge@gcc.gnu.org>
To: gcc-cvs@gcc.gnu.org
Subject: [gcc/devel/rust/master] parser: Fix ICE in closure parsing
Date: Thu, 27 Oct 2022 07:50:28 +0000 (GMT)	[thread overview]
Message-ID: <20221027075028.75E28382A2CD@sourceware.org> (raw)

https://gcc.gnu.org/g:db4b399c25fd3c37e52c6b8dbdf6bc9c0f1deb6c

commit db4b399c25fd3c37e52c6b8dbdf6bc9c0f1deb6c
Author: Arthur Cohen <arthur.cohen@embecosm.com>
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<ManagedTokenSource>::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).

                 reply	other threads:[~2022-10-27  7:50 UTC|newest]

Thread overview: [no followups] expand[flat|nested]  mbox.gz  Atom feed

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20221027075028.75E28382A2CD@sourceware.org \
    --to=tschwinge@gcc.gnu.org \
    --cc=gcc-cvs@gcc.gnu.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).