public inbox for gcc-cvs@sourceware.org
help / color / mirror / Atom feed
* [gcc/devel/rust/master] Add testcase for const array index expressions
@ 2022-08-29 15:36 Thomas Schwinge
  0 siblings, 0 replies; only message in thread
From: Thomas Schwinge @ 2022-08-29 15:36 UTC (permalink / raw)
  To: gcc-cvs

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

commit c52268c6d22bcecef596dffd3c31b78d225f59b6
Author: Philip Herron <philip.herron@embecosm.com>
Date:   Thu Aug 25 13:46:27 2022 +0100

    Add testcase for const array index expressions

Diff:
---
 gcc/testsuite/rust/compile/const5.rs | 5 +++++
 1 file changed, 5 insertions(+)

diff --git a/gcc/testsuite/rust/compile/const5.rs b/gcc/testsuite/rust/compile/const5.rs
new file mode 100644
index 00000000000..1965f8e7951
--- /dev/null
+++ b/gcc/testsuite/rust/compile/const5.rs
@@ -0,0 +1,5 @@
+// { dg-options "-w -O0 -fdump-tree-gimple" }
+const A: usize = 123;
+const B: [i32; 5] = [1, 2, 3, 4, 5];
+const C: i32 = B[A];
+// { dg-error "array subscript value .123. is outside the bounds of array" "" { target *-*-* } .-1 }

^ permalink raw reply	[flat|nested] only message in thread

only message in thread, other threads:[~2022-08-29 15:36 UTC | newest]

Thread overview: (only message) (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2022-08-29 15:36 [gcc/devel/rust/master] Add testcase for const array index expressions Thomas Schwinge

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).