[gcc r14-7520] gccrs: Fix ICE in assignment of error type bound predicates

Arthur Cohen cohenarthur@gcc.gnu.org
Tue Jan 16 17:41:01 GMT 2024


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

commit r14-7520-gcd587fbc1de242a389209974f468dcd8094abb74
Author: Philip Herron <herron.philip@googlemail.com>
Date:   Thu Apr 20 11:55:20 2023 +0100

    gccrs: Fix ICE in assignment of error type bound predicates
    
    gcc/rust/ChangeLog:
    
            * typecheck/rust-tyty-bounds.cc (TypeBoundPredicate::operator=):
            we are done if other is in an error state
    
    Signed-off-by: Philip Herron <herron.philip@googlemail.com>

Diff:
---
 gcc/rust/typecheck/rust-tyty-bounds.cc | 3 +++
 1 file changed, 3 insertions(+)

diff --git a/gcc/rust/typecheck/rust-tyty-bounds.cc b/gcc/rust/typecheck/rust-tyty-bounds.cc
index 23a2926faeb..dc4418ff27b 100644
--- a/gcc/rust/typecheck/rust-tyty-bounds.cc
+++ b/gcc/rust/typecheck/rust-tyty-bounds.cc
@@ -360,6 +360,9 @@ TypeBoundPredicate::operator= (const TypeBoundPredicate &other)
   for (const auto &p : other.get_substs ())
     substitutions.push_back (p.clone ());
 
+  if (other.is_error ())
+    return *this;
+
   std::vector<SubstitutionArg> mappings;
   for (size_t i = 0; i < other.used_arguments.get_mappings ().size (); i++)
     {


More information about the Gcc-cvs mailing list