From 10e35d15734fffb419a3cd19f8e0726bc58bbda1 Mon Sep 17 00:00:00 2001 From: Lars-Peter Clausen Date: Sun, 17 Apr 2022 13:27:14 +0200 Subject: [PATCH] Add regression tests for circular type definitions Check that circular type definitions are detected and an error is reported. Signed-off-by: Lars-Peter Clausen --- ivtest/ivltests/sv_typedef_circular1.v | 14 ++++++++++++++ ivtest/ivltests/sv_typedef_circular2.v | 18 ++++++++++++++++++ ivtest/regress-sv.list | 2 ++ 3 files changed, 34 insertions(+) create mode 100644 ivtest/ivltests/sv_typedef_circular1.v create mode 100644 ivtest/ivltests/sv_typedef_circular2.v diff --git a/ivtest/ivltests/sv_typedef_circular1.v b/ivtest/ivltests/sv_typedef_circular1.v new file mode 100644 index 000000000..998a21a50 --- /dev/null +++ b/ivtest/ivltests/sv_typedef_circular1.v @@ -0,0 +1,14 @@ +// Check that circular type definitions are detected and an error is reported. + +module test; + typedef T1; + typedef T1 T2; + typedef T2 T1; + + T2 x; + + initial begin + $display("FAILED"); + end + +endmodule diff --git a/ivtest/ivltests/sv_typedef_circular2.v b/ivtest/ivltests/sv_typedef_circular2.v new file mode 100644 index 000000000..638744e20 --- /dev/null +++ b/ivtest/ivltests/sv_typedef_circular2.v @@ -0,0 +1,18 @@ +// Check that longer chains of circular type definitions are detected as an +// error. + +module test; + + typedef T1; + + typedef struct packed { + T1 x; + } T2; + + typedef T2 [1:0] T3; + + typedef T3 T1; + + T1 x; + +endmodule diff --git a/ivtest/regress-sv.list b/ivtest/regress-sv.list index 7738d2119..f9456c777 100644 --- a/ivtest/regress-sv.list +++ b/ivtest/regress-sv.list @@ -716,6 +716,8 @@ sv_typedef_array_base2 normal,-g2009 ivltests sv_typedef_array_base3 normal,-g2009 ivltests sv_typedef_array_base4 normal,-g2009 ivltests sv_typedef_chained normal,-g2009 ivltests +sv_typedef_circular1 CE,-g2009 ivltests +sv_typedef_circular2 CE,-g2009 ivltests sv_typedef_darray_base1 normal,-g2009 ivltests sv_typedef_darray_base2 normal,-g2009 ivltests sv_typedef_darray_base3 normal,-g2009 ivltests