forked from github/verilator
Fix foreach unnamedblk duplicate error (#3885).
This commit is contained in:
parent
6a60ace2c7
commit
035bf13e4a
1
Changes
1
Changes
@ -29,6 +29,7 @@ Verilator 5.005 devel
|
|||||||
* Fix memory leak in V3Sched, etc. (#3834). [Geza Lore]
|
* Fix memory leak in V3Sched, etc. (#3834). [Geza Lore]
|
||||||
* Fix compatibility with musl libc / Alpine Linux (#3845). [Sören Tempel]
|
* Fix compatibility with musl libc / Alpine Linux (#3845). [Sören Tempel]
|
||||||
* Fix empty case items crash (#3851). [rporter]
|
* Fix empty case items crash (#3851). [rporter]
|
||||||
|
* Fix foreach unnamedblk duplicate error (#3885). [Ilya Barkov]
|
||||||
|
|
||||||
|
|
||||||
Verilator 5.004 2022-12-14
|
Verilator 5.004 2022-12-14
|
||||||
|
@ -1029,8 +1029,13 @@ class LinkDotFindVisitor final : public VNVisitor {
|
|||||||
// are common.
|
// are common.
|
||||||
for (AstNode* stmtp = nodep->stmtsp(); stmtp; stmtp = stmtp->nextp()) {
|
for (AstNode* stmtp = nodep->stmtsp(); stmtp; stmtp = stmtp->nextp()) {
|
||||||
if (VN_IS(stmtp, Var) || VN_IS(stmtp, Foreach)) {
|
if (VN_IS(stmtp, Var) || VN_IS(stmtp, Foreach)) {
|
||||||
|
std::string name;
|
||||||
|
do {
|
||||||
++m_modBlockNum;
|
++m_modBlockNum;
|
||||||
nodep->name("unnamedblk" + cvtToStr(m_modBlockNum));
|
name = "unnamedblk" + cvtToStr(m_modBlockNum);
|
||||||
|
// Increment again if earlier pass of V3LinkDot claimed this name
|
||||||
|
} while (m_curSymp->findIdFlat(name));
|
||||||
|
nodep->name(name);
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
17
test_regress/t/t_foreach_blkname.pl
Executable file
17
test_regress/t/t_foreach_blkname.pl
Executable file
@ -0,0 +1,17 @@
|
|||||||
|
#!/usr/bin/env perl
|
||||||
|
if (!$::Driver) { use FindBin; exec("$FindBin::Bin/bootstrap.pl", @ARGV, $0); die; }
|
||||||
|
# DESCRIPTION: Verilator: Verilog Test driver/expect definition
|
||||||
|
#
|
||||||
|
# Copyright 2023 by Wilson Snyder. 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-License-Identifier: LGPL-3.0-only OR Artistic-2.0
|
||||||
|
|
||||||
|
scenarios(linter => 1);
|
||||||
|
|
||||||
|
lint(
|
||||||
|
);
|
||||||
|
|
||||||
|
ok(1);
|
||||||
|
1;
|
16
test_regress/t/t_foreach_blkname.v
Normal file
16
test_regress/t/t_foreach_blkname.v
Normal file
@ -0,0 +1,16 @@
|
|||||||
|
// DESCRIPTION: Verilator: Verilog Test module
|
||||||
|
//
|
||||||
|
// This file ONLY is placed under the Creative Commons Public Domain, for
|
||||||
|
// any use, without warranty, 2023 by Wilson Snyder
|
||||||
|
// SPDX-License-Identifier: CC0-1.0
|
||||||
|
|
||||||
|
module t;
|
||||||
|
function void func();
|
||||||
|
int a[2];
|
||||||
|
begin
|
||||||
|
int t;
|
||||||
|
end
|
||||||
|
foreach (a[i]) begin
|
||||||
|
end
|
||||||
|
endfunction
|
||||||
|
endmodule
|
Loading…
Reference in New Issue
Block a user