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] gccrs: Fix ICE when we dont get a reference type
Date: Tue,  2 May 2023 07:10:58 +0000 (GMT)	[thread overview]
Message-ID: <20230502071058.CCCFF3858C30@sourceware.org> (raw)

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

                 reply	other threads:[~2023-05-02  7:10 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=20230502071058.CCCFF3858C30@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).