From f8401095aa1bb786f5fa715985366a935a0268ae Mon Sep 17 00:00:00 2001 From: Lars-Peter Clausen Date: Sun, 4 Dec 2022 21:55:38 -0800 Subject: [PATCH] Add regression test for too many foreach loop indices Check that an error is reported if too many indices are specified in a foreach loop. Signed-off-by: Lars-Peter Clausen --- ivtest/ivltests/sv_foreach_fail1.v | 14 ++++++++++++++ ivtest/regress-sv.list | 1 + 2 files changed, 15 insertions(+) create mode 100644 ivtest/ivltests/sv_foreach_fail1.v diff --git a/ivtest/ivltests/sv_foreach_fail1.v b/ivtest/ivltests/sv_foreach_fail1.v new file mode 100644 index 000000000..e8429db19 --- /dev/null +++ b/ivtest/ivltests/sv_foreach_fail1.v @@ -0,0 +1,14 @@ +// Check that an error is reported if the number of loop indices exceeds the +// number of array dimensions in a foreach loop. + +module test; + + logic a[10]; + + initial begin + foreach(a[i,j]) begin + $display("FAILED"); + end + end + +endmodule diff --git a/ivtest/regress-sv.list b/ivtest/regress-sv.list index f9456c777..3442ede3b 100644 --- a/ivtest/regress-sv.list +++ b/ivtest/regress-sv.list @@ -600,6 +600,7 @@ sv_foreach2 normal,-g2009 ivltests sv_foreach3 normal,-g2009 ivltests sv_foreach4 normal,-g2009 ivltests sv_foreach5 normal,-g2009 ivltests +sv_foreach_fail1 CE,-g2009 ivltests sv_immediate_assert normal,-g2009 ivltests gold=sv_immediate_assert.gold sv_immediate_assume normal,-g2009 ivltests gold=sv_immediate_assume.gold sv_macro normal,-g2009 ivltests