aboutsummaryrefslogtreecommitdiff
path: root/gcc/testsuite
diff options
context:
space:
mode:
authorPhilip Herron <herron.philip@googlemail.com>2025-03-27 17:27:56 +0000
committerArthur Cohen <arthur.cohen@embecosm.com>2025-03-31 21:07:20 +0200
commit732c9d0cd5d1ebfee57aa1f4ee5d1487765d5ca7 (patch)
tree9b4cefa2dc1f7dc59aa8a6f6077bc9099ee7fdac /gcc/testsuite
parent564d76525f6a7a17deb5632da84ff6eefd7c0ce5 (diff)
downloadgcc-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/testsuite')
-rw-r--r--gcc/testsuite/rust/compile/issue-3588.rs5
1 files changed, 5 insertions, 0 deletions
diff --git a/gcc/testsuite/rust/compile/issue-3588.rs b/gcc/testsuite/rust/compile/issue-3588.rs
new file mode 100644
index 0000000..744d967
--- /dev/null
+++ b/gcc/testsuite/rust/compile/issue-3588.rs
@@ -0,0 +1,5 @@
+const FOO: i32 = if true { [1, 2, 3] } else { [2, 3, 4] }[0];
+
+pub fn test() -> i32 {
+ FOO
+}