diff options
author | Philip Herron <herron.philip@googlemail.com> | 2025-03-27 17:27:56 +0000 |
---|---|---|
committer | Arthur Cohen <arthur.cohen@embecosm.com> | 2025-03-31 21:07:20 +0200 |
commit | 732c9d0cd5d1ebfee57aa1f4ee5d1487765d5ca7 (patch) | |
tree | 9b4cefa2dc1f7dc59aa8a6f6077bc9099ee7fdac /gcc/rust/backend/rust-compile-context.h | |
parent | 564d76525f6a7a17deb5632da84ff6eefd7c0ce5 (diff) | |
download | gcc-732c9d0cd5d1ebfee57aa1f4ee5d1487765d5ca7.zip gcc-732c9d0cd5d1ebfee57aa1f4ee5d1487765d5ca7.tar.gz gcc-732c9d0cd5d1ebfee57aa1f4ee5d1487765d5ca7.tar.bz2 |
gccrs: Fix ICE during const expr eval on array expressions
Array expressions are still getting turned into VIEW_CONVERT_EXPR's becuase
TYPE_MAIN_VARIANT is not set so then we might as well reuse the type-hasher
to sort this out.
Fixes Rust-GCC#3588
gcc/rust/ChangeLog:
* backend/rust-compile-context.h: only push named types
* backend/rust-compile-type.cc (TyTyResolveCompile::visit): run the type hasher
gcc/testsuite/ChangeLog:
* rust/compile/issue-3588.rs: New test.
Signed-off-by: Philip Herron <herron.philip@googlemail.com>
Diffstat (limited to 'gcc/rust/backend/rust-compile-context.h')
-rw-r--r-- | gcc/rust/backend/rust-compile-context.h | 5 |
1 files changed, 4 insertions, 1 deletions
diff --git a/gcc/rust/backend/rust-compile-context.h b/gcc/rust/backend/rust-compile-context.h index a446388..ce81a1d 100644 --- a/gcc/rust/backend/rust-compile-context.h +++ b/gcc/rust/backend/rust-compile-context.h @@ -72,7 +72,10 @@ public: return it->second; compiled_type_map.insert ({h, type}); - push_type (type); + + if (TYPE_NAME (type) != NULL) + push_type (type); + return type; } |