From 832917008c55de0022593b707ae7566bc0005212 Mon Sep 17 00:00:00 2001 From: Lars-Peter Clausen Date: Thu, 15 Sep 2022 12:22:03 +0200 Subject: [PATCH] Handle unpacked dimensions for struct and union members Unpacked dimensions for struct or union members are currently silently discarded. E.g. ``` struct packed { int x[2]; } s; ``` will elaborate successfully as a struct with a non-array int typed field. This should instead elaborate to an unpacked array of ints typed field. And subsequently, since unpacked arrays are not allowed in a packed struct or union, result in an error instead. Signed-off-by: Lars-Peter Clausen --- elab_type.cc | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/elab_type.cc b/elab_type.cc index 413e6f61c..41bdbf15f 100644 --- a/elab_type.cc +++ b/elab_type.cc @@ -215,7 +215,8 @@ ivl_type_t struct_type_t::elaborate_type_raw(Design*des, NetScope*scope) const netstruct_t::member_t memb; memb.name = namep->name; - memb.net_type = mem_vec; + memb.net_type = elaborate_array_type(des, scope, *this, + mem_vec, namep->index); res->append_member(des, memb); } }