public inbox for gcc-cvs@sourceware.org
help / color / mirror / Atom feed
* [gcc/devel/rust/master] parser: Fix ICE in closure parsing
@ 2022-10-27  7:50 Thomas Schwinge
  0 siblings, 0 replies; only message in thread
From: Thomas Schwinge @ 2022-10-27  7:50 UTC (permalink / raw)
  To: gcc-cvs

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).

^ permalink raw reply	[flat|nested] only message in thread

only message in thread, other threads:[~2022-10-27  7:50 UTC | newest]

Thread overview: (only message) (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2022-10-27  7:50 [gcc/devel/rust/master] parser: Fix ICE in closure parsing Thomas Schwinge

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).