forked from github/verilator
Fix empty case items crash (#3851).
This commit is contained in:
parent
7e4760a7e4
commit
5fce23e90d
1
Changes
1
Changes
@ -28,6 +28,7 @@ Verilator 5.005 devel
|
|||||||
* Fix self references when param class instantiated (#3833). [Ryszard Rozak, Antmicro Ltd]
|
* Fix self references when param class instantiated (#3833). [Ryszard Rozak, Antmicro Ltd]
|
||||||
* 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]
|
||||||
|
|
||||||
|
|
||||||
Verilator 5.004 2022-12-14
|
Verilator 5.004 2022-12-14
|
||||||
|
@ -274,7 +274,9 @@ private:
|
|||||||
// Convert valueItem from AstCaseItem* to the expression
|
// Convert valueItem from AstCaseItem* to the expression
|
||||||
// Not done earlier, as we may now have a nullptr because it's just a ";" NOP branch
|
// Not done earlier, as we may now have a nullptr because it's just a ";" NOP branch
|
||||||
for (uint32_t i = 0; i < numCases; ++i) {
|
for (uint32_t i = 0; i < numCases; ++i) {
|
||||||
m_valueItem[i] = VN_AS(m_valueItem[i], CaseItem)->stmtsp();
|
if (AstCaseItem* const itemp = VN_AS(m_valueItem[i], CaseItem)) {
|
||||||
|
m_valueItem[i] = itemp->stmtsp();
|
||||||
|
}
|
||||||
}
|
}
|
||||||
return true; // All is fine
|
return true; // All is fine
|
||||||
}
|
}
|
||||||
|
22
test_regress/t/t_case_enum_emptyish.pl
Executable file
22
test_regress/t/t_case_enum_emptyish.pl
Executable file
@ -0,0 +1,22 @@
|
|||||||
|
#!/usr/bin/env perl
|
||||||
|
if (!$::Driver) { use FindBin; exec("$FindBin::Bin/bootstrap.pl", @ARGV, $0); die; }
|
||||||
|
# DESCRIPTION: Verilator: Verilog Test driver/expect definition
|
||||||
|
#
|
||||||
|
# Copyright 2003 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(simulator => 1);
|
||||||
|
|
||||||
|
compile(
|
||||||
|
verilator_flags2 => ["--compiler msvc"], # We have deep expressions we want to test
|
||||||
|
);
|
||||||
|
|
||||||
|
execute(
|
||||||
|
check_finished => 1,
|
||||||
|
);
|
||||||
|
|
||||||
|
ok(1);
|
||||||
|
1;
|
29
test_regress/t/t_case_enum_emptyish.v
Normal file
29
test_regress/t/t_case_enum_emptyish.v
Normal file
@ -0,0 +1,29 @@
|
|||||||
|
// 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 (/*AUTOARG*/);
|
||||||
|
|
||||||
|
enum logic [2:0] {
|
||||||
|
e0,
|
||||||
|
e1,
|
||||||
|
e2,
|
||||||
|
e3
|
||||||
|
} EN;
|
||||||
|
|
||||||
|
initial begin
|
||||||
|
|
||||||
|
unique case (EN)
|
||||||
|
e0 :;
|
||||||
|
e1 :;
|
||||||
|
e2 :;
|
||||||
|
e3 :;
|
||||||
|
endcase
|
||||||
|
|
||||||
|
$write("*-* All Finished *-*\n");
|
||||||
|
$finish;
|
||||||
|
end
|
||||||
|
|
||||||
|
endmodule
|
Loading…
Reference in New Issue
Block a user