mirror of
https://github.com/verilator/verilator.git
synced 2024-12-29 10:47:34 +00:00
Fix crash with internal assertion on short array initializer (partial #5511)
This commit is contained in:
parent
f98637e122
commit
69ac3c14e8
@ -82,7 +82,9 @@ protected:
|
||||
for (uint64_t n = 0; n < size; ++n) {
|
||||
m_unpackedWord = n;
|
||||
if (n) puts((n % tabMod) ? ", " : ",\n");
|
||||
iterateConst(nodep->getIndexDefaultedValuep(n));
|
||||
AstNode* const itemp = nodep->getIndexDefaultedValuep(n);
|
||||
UASSERT_OBJ(itemp, nodep, "Missing array init element");
|
||||
iterateConst(itemp);
|
||||
}
|
||||
puts("\n");
|
||||
puts("}");
|
||||
|
4
test_regress/t/t_unpacked_concat_bad3.out
Normal file
4
test_regress/t/t_unpacked_concat_bad3.out
Normal file
@ -0,0 +1,4 @@
|
||||
%Error: Internal Error: t/t_unpacked_concat_bad3.v:9:41: ../V3EmitCConstInit.h:#: Missing array init element
|
||||
9 | localparam logic [7:0] TOO_FEW [5] = '{0, 1, 2**8-1};
|
||||
| ^~
|
||||
... See the manual at https://verilator.org/verilator_doc.html for more assistance.
|
17
test_regress/t/t_unpacked_concat_bad3.py
Executable file
17
test_regress/t/t_unpacked_concat_bad3.py
Executable file
@ -0,0 +1,17 @@
|
||||
#!/usr/bin/env python3
|
||||
# DESCRIPTION: Verilator: Verilog Test driver/expect definition
|
||||
#
|
||||
# Copyright 2024 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
|
||||
|
||||
import vltest_bootstrap
|
||||
|
||||
test.scenarios('vlt')
|
||||
|
||||
# Not lint, crashes in V3EmitCConstInit.h
|
||||
test.compile(fails=True, expect_filename=test.golden_filename)
|
||||
|
||||
test.passes()
|
15
test_regress/t/t_unpacked_concat_bad3.v
Normal file
15
test_regress/t/t_unpacked_concat_bad3.v
Normal file
@ -0,0 +1,15 @@
|
||||
// DESCRIPTION: Verilator: Verilog Test module
|
||||
//
|
||||
// This file ONLY is placed into the Public Domain, for any use,
|
||||
// without warranty, 2019 by Driss Hafdi.
|
||||
// SPDX-License-Identifier: CC0-1.0
|
||||
|
||||
module t (/*AUTOARG*/);
|
||||
|
||||
localparam logic [7:0] TOO_FEW [5] = '{0, 1, 2**8-1}; // Bad
|
||||
|
||||
initial begin
|
||||
$display("%p", TOO_FEW);
|
||||
$stop;
|
||||
end
|
||||
endmodule
|
Loading…
Reference in New Issue
Block a user