public inbox for gcc-cvs@sourceware.org
help / color / mirror / Atom feed
* [gcc/devel/rust/master] gccrs: Fix ICE when we dont get a reference type
@ 2023-05-02  7:10 Thomas Schwinge
  0 siblings, 0 replies; only message in thread
From: Thomas Schwinge @ 2023-05-02  7:10 UTC (permalink / raw)
  To: gcc-cvs

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

commit dd0677cf09c363ae55f5eb76808fdde3eb18dd03
Author: Philip Herron <herron.philip@googlemail.com>
Date:   Fri Apr 21 17:52:01 2023 +0100

    gccrs: Fix ICE when we dont get a reference type
    
    gcc/rust/ChangeLog:
    
            * typecheck/rust-hir-type-check-pattern.cc (TypeCheckPattern::visit):
            return so we dont hit undefined behaviour
    
    Signed-off-by: Philip Herron <herron.philip@googlemail.com>

Diff:
---
 gcc/rust/typecheck/rust-hir-type-check-pattern.cc | 7 +++++--
 1 file changed, 5 insertions(+), 2 deletions(-)

diff --git a/gcc/rust/typecheck/rust-hir-type-check-pattern.cc b/gcc/rust/typecheck/rust-hir-type-check-pattern.cc
index 5c8fd9a38af..edd4ceb48ae 100644
--- a/gcc/rust/typecheck/rust-hir-type-check-pattern.cc
+++ b/gcc/rust/typecheck/rust-hir-type-check-pattern.cc
@@ -362,8 +362,11 @@ void
 TypeCheckPattern::visit (HIR::ReferencePattern &pattern)
 {
   if (parent->get_kind () != TyTy::TypeKind::REF)
-    rust_error_at (pattern.get_locus (), "expected %s, found reference",
-		   parent->as_string ().c_str ());
+    {
+      rust_error_at (pattern.get_locus (), "expected %s, found reference",
+		     parent->as_string ().c_str ());
+      return;
+    }
 
   TyTy::ReferenceType *ref_ty_ty = static_cast<TyTy::ReferenceType *> (parent);
   TyTy::BaseType *infered_base

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

only message in thread, other threads:[~2023-05-02  7:10 UTC | newest]

Thread overview: (only message) (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2023-05-02  7:10 [gcc/devel/rust/master] gccrs: Fix ICE when we dont get a reference type 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).