Fix compound types in anonymous structs (#8449)

Signed-off-by: Artur Bieniek <[email protected]>
This commit is contained in:
Artur Bieniek
2026-09-22 12:41:11 -04:00
committed by GitHub
parent 08c9032927
commit f04eb8de81
3 changed files with 57 additions and 2 deletions
+1 -2
View File
@@ -74,8 +74,7 @@ public:
return v3Global.opt.compLimitMembers() != 0 // Enabled
&& !varp->isStatic() // Not a static variable
&& !varp->isSc() // Aggregates can't be anon
&& !VN_IS(dtp, SampleQueueDType) // Aggregates can't be anon
&& !(VN_IS(dtp, NodeUOrStructDType) && !VN_CAST(dtp, NodeUOrStructDType)->packed())
&& !dtp->isCompound() // Non-POD members are not allowed in an anonymous aggregate
&& (varp->basicp() && !varp->basicp()->isOpaque()); // Aggregates can't be anon
}
static bool isConstPoolMod(const AstNode* modp) {
+18
View File
@@ -0,0 +1,18 @@
#!/usr/bin/env python3
# DESCRIPTION: Verilator: Verilog Test driver/expect definition
#
# This program is free software; you can redistribute it and/or modify it
# under the terms of either the GNU Lesser General Public License Version 3
# or the Perl Artistic License Version 2.0.
# SPDX-FileCopyrightText: 2026 Wilson Snyder
# SPDX-License-Identifier: LGPL-3.0-only OR Artistic-2.0
import vltest_bootstrap
test.scenarios('vlt')
test.compile(verilator_flags2=["--comp-limit-members 1"])
test.execute()
test.passes()
+38
View File
@@ -0,0 +1,38 @@
// DESCRIPTION: Verilator: Verilog Test module
//
// This file ONLY is placed under the Creative Commons Public Domain.
// SPDX-FileCopyrightText: 2026 Antmicro
// SPDX-License-Identifier: CC0-1.0
// verilog_format: off
`define stop $stop
`define checkh(gotv,expv) do if ((gotv) !== (expv)) begin $write("%%Error: %s:%0d: got='h%x exp='h%x\n", `__FILE__,`__LINE__, (gotv), (expv)); `stop; end while(0);
// verilog_format: on
module t (
input clk
);
reg [7:0] da0[*];
reg [7:0] da1[2][*];
integer cyc = 0;
always @(posedge clk) begin
cyc <= cyc + 1;
if (cyc == 0) begin
da0[1] = 8'h11;
da1[0][2] = 8'h22;
da1[1][3] = 8'h33;
end else if (cyc == 1) begin
`checkh(da0.size(), 1);
`checkh(da0[1], 8'h11);
`checkh(da1[0].size(), 1);
`checkh(da1[0][2], 8'h22);
`checkh(da1[1][3], 8'h33);
$write("*-* All Finished *-*\n");
$finish;
end
end
endmodule