Add regression tests for packed struct/union with unpacked array members

Check that a packed struct or union with an unpacked array, dynamic array
or queue as a member is detected as an error.

Signed-off-by: Lars-Peter Clausen <lars@metafoo.de>
This commit is contained in:
Lars-Peter Clausen 2022-09-15 12:29:48 +02:00
parent 832917008c
commit cff24f77b4
7 changed files with 90 additions and 0 deletions

View File

@ -0,0 +1,14 @@
// Check that declaring a dynamic array typed member in a packed struct is an
// error.
module test;
struct packed {
int x[];
} s;
initial begin
$display("FAILED");
end
endmodule

View File

@ -0,0 +1,13 @@
// Check that declaring a queue typed member in a packed struct is an error.
module test;
struct packed {
int x[$];
} s;
initial begin
$display("FAILED");
end
endmodule

View File

@ -0,0 +1,14 @@
// Check that declaring an unpacked array typed member in a packed struct is an
// error.
module test;
struct packed {
int x[2];
} s;
initial begin
$display("FAILED");
end
endmodule

View File

@ -0,0 +1,14 @@
// Check that declaring a dynamic array typed member in a packed union is an
// error.
module test;
union packed {
int x[];
} s;
initial begin
$display("FAILED");
end
endmodule

View File

@ -0,0 +1,14 @@
// Check that declaring a queue typed member in a packed union is an
// error.
module test;
union packed {
int x[$];
} s;
initial begin
$display("FAILED");
end
endmodule

View File

@ -0,0 +1,15 @@
// Check that declaring an unpacked array typed member in a packed union is an
// error.
module test;
struct packed {
int x;
shortint y[2];
} s;
initial begin
$display("FAILED");
end
endmodule

View File

@ -470,8 +470,11 @@ struct_line_info CE,-g2009 ivltests gold=struct_line_info.gold
struct_member_signed normal,-g2009 ivltests
struct_packed_array normal,-g2009 ivltests
struct_packed_array2 normal,-g2009 ivltests
struct_packed_darray_fail CE,-g2009 ivltests
struct_packed_queue_fail CE,-g2009 ivltests
struct_packed_sysfunct normal,-g2009 ivltests
struct_packed_sysfunct2 normal,-g2009 ivltests
struct_packed_uarray_fail CE,-g2009 ivltests
struct_packed_write_read2 normal,-g2009 ivltests
struct_invalid_member CE,-g2009 ivltests gold=struct_invalid_member.gold
struct_signed normal,-g2009 ivltests
@ -752,6 +755,9 @@ ubyte_test normal,-g2005-sv ivltests
uint_test normal,-g2005-sv ivltests
ulongint_test normal,-g2005-sv ivltests
undef_lval_select_SV normal,-g2009 ivltests
union_packed_darray_fail CE,-g2009 ivltests
union_packed_queue_fail CE,-g2009 ivltests
union_packed_uarray_fail CE,-g2009 ivltests
unp_array_typedef normal,-g2005-sv ivltests
packed_dims_invalid_class CE,-g2005-sv ivltests
packed_dims_invalid_module CE,-g2005-sv ivltests