[gcc r14-7300] gccrs: Fix ICE in ADTType::is_concrete
Arthur Cohen
cohenarthur@gcc.gnu.org
Tue Jan 16 17:20:38 GMT 2024
https://gcc.gnu.org/g:4306bf12227d62ebcb8b2d9c3d570be8e4b767ff
commit r14-7300-g4306bf12227d62ebcb8b2d9c3d570be8e4b767ff
Author: Philip Herron <herron.philip@googlemail.com>
Date: Sun Feb 26 22:36:20 2023 +0000
gccrs: Fix ICE in ADTType::is_concrete
Signed-off-by: Philip Herron <herron.philip@googlemail.com>
gcc/rust/ChangeLog:
* typecheck/rust-tyty.cc (ADTType::is_concrete): need to consider if is a num_variant
* typecheck/rust-tyty.h: refactor to cc file
Diff:
---
gcc/rust/typecheck/rust-tyty.cc | 24 ++++++++++++++++++++++++
gcc/rust/typecheck/rust-tyty.h | 18 +-----------------
2 files changed, 25 insertions(+), 17 deletions(-)
diff --git a/gcc/rust/typecheck/rust-tyty.cc b/gcc/rust/typecheck/rust-tyty.cc
index a1f4911511a..dc7a08f4792 100644
--- a/gcc/rust/typecheck/rust-tyty.cc
+++ b/gcc/rust/typecheck/rust-tyty.cc
@@ -1110,6 +1110,30 @@ ADTType::as_string () const
return identifier + subst_as_string () + "{" + variants_buffer + "}";
}
+bool
+ADTType::is_concrete () const
+{
+ if (is_unit ())
+ {
+ return !needs_substitution ();
+ }
+
+ for (auto &variant : variants)
+ {
+ bool is_num_variant
+ = variant->get_variant_type () == VariantDef::VariantType::NUM;
+ if (is_num_variant)
+ continue;
+
+ for (auto &field : variant->get_fields ())
+ {
+ if (!field->is_concrete ())
+ return false;
+ }
+ }
+ return true;
+}
+
bool
ADTType::can_eq (const BaseType *other, bool emit_errors) const
{
diff --git a/gcc/rust/typecheck/rust-tyty.h b/gcc/rust/typecheck/rust-tyty.h
index ddc34636ae7..5516cd70385 100644
--- a/gcc/rust/typecheck/rust-tyty.h
+++ b/gcc/rust/typecheck/rust-tyty.h
@@ -604,23 +604,7 @@ public:
return identifier + subst_as_string ();
}
- bool is_concrete () const override final
- {
- if (is_unit ())
- {
- return !needs_substitution ();
- }
-
- for (auto &variant : variants)
- {
- for (auto &field : variant->get_fields ())
- {
- if (!field->is_concrete ())
- return false;
- }
- }
- return true;
- }
+ bool is_concrete () const override final;
BaseType *clone () const final override;
BaseType *monomorphized_clone () const final override;
More information about the Gcc-cvs
mailing list