mirror of
https://github.com/verilator/verilator.git
synced 2025-01-01 04:07:34 +00:00
Fix internal error on missing pattern key (#5023)
This commit is contained in:
parent
98206a4f04
commit
db60b92613
1
Changes
1
Changes
@ -48,6 +48,7 @@ Verilator 5.023 devel
|
||||
* Fix inout ports of unpacked struct type (#5000). [Ryszard Rozak, Antmicro Ltd.]
|
||||
* Fix `unique {}` constraints missing semicolon (#5001)
|
||||
* Fix preprocessor to respect strings in joins (#5007)
|
||||
* Fix internal error on missing pattern key (#5023)
|
||||
|
||||
|
||||
Verilator 5.022 2024-02-24
|
||||
|
@ -4284,9 +4284,14 @@ class WidthVisitor final : public VNVisitor {
|
||||
patp = VN_AS(patp->nextp(), PatMember)) {
|
||||
patp->dtypep(arrayDtp->subDTypep());
|
||||
AstNodeExpr* const valuep = patternMemberValueIterate(patp);
|
||||
AstNode* const keyp = patp->keyp();
|
||||
auto* const newap
|
||||
= new AstSetAssoc{nodep->fileline(), newp, keyp->unlinkFrBack(), valuep};
|
||||
AstNode* keyp = patp->keyp();
|
||||
if (!keyp) {
|
||||
patp->v3error("Missing pattern key (need an expression then a ':')");
|
||||
keyp = new AstConst{nodep->fileline(), AstConst::Signed32{}, 0};
|
||||
} else {
|
||||
keyp->unlinkFrBack();
|
||||
}
|
||||
AstSetAssoc* const newap = new AstSetAssoc{nodep->fileline(), newp, keyp, valuep};
|
||||
newap->dtypeFrom(arrayDtp);
|
||||
newp = newap;
|
||||
}
|
||||
@ -4305,7 +4310,7 @@ class WidthVisitor final : public VNVisitor {
|
||||
patp->dtypep(arrayDtp->subDTypep());
|
||||
AstNodeExpr* const valuep = patternMemberValueIterate(patp);
|
||||
AstNode* const keyp = patp->keyp();
|
||||
auto* const newap
|
||||
AstSetWildcard* const newap
|
||||
= new AstSetWildcard{nodep->fileline(), newp, keyp->unlinkFrBack(), valuep};
|
||||
newap->dtypeFrom(arrayDtp);
|
||||
newp = newap;
|
||||
@ -4321,7 +4326,7 @@ class WidthVisitor final : public VNVisitor {
|
||||
patp = VN_AS(patp->nextp(), PatMember)) {
|
||||
patp->dtypep(arrayp->subDTypep());
|
||||
AstNodeExpr* const valuep = patternMemberValueIterate(patp);
|
||||
auto* const newap = new AstConsDynArray{nodep->fileline(), valuep, newp};
|
||||
AstConsDynArray* const newap = new AstConsDynArray{nodep->fileline(), valuep, newp};
|
||||
newap->dtypeFrom(arrayp);
|
||||
newp = newap;
|
||||
}
|
||||
@ -4336,7 +4341,7 @@ class WidthVisitor final : public VNVisitor {
|
||||
patp = VN_AS(patp->nextp(), PatMember)) {
|
||||
patp->dtypep(arrayp->subDTypep());
|
||||
AstNodeExpr* const valuep = patternMemberValueIterate(patp);
|
||||
auto* const newap = new AstConsQueue{nodep->fileline(), valuep, newp};
|
||||
AstConsQueue* const newap = new AstConsQueue{nodep->fileline(), valuep, newp};
|
||||
newap->dtypeFrom(arrayp);
|
||||
newp = newap;
|
||||
}
|
||||
|
9
test_regress/t/t_assoc_nokey_bad.out
Normal file
9
test_regress/t/t_assoc_nokey_bad.out
Normal file
@ -0,0 +1,9 @@
|
||||
%Error: t/t_assoc_nokey_bad.v:12:28: Missing pattern key (need an expression then a ':')
|
||||
: ... note: In instance 't'
|
||||
12 | int dict[string] = '{1, 2};
|
||||
| ^
|
||||
%Error: t/t_assoc_nokey_bad.v:12:31: Missing pattern key (need an expression then a ':')
|
||||
: ... note: In instance 't'
|
||||
12 | int dict[string] = '{1, 2};
|
||||
| ^
|
||||
%Error: Exiting due to
|
19
test_regress/t/t_assoc_nokey_bad.pl
Executable file
19
test_regress/t/t_assoc_nokey_bad.pl
Executable file
@ -0,0 +1,19 @@
|
||||
#!/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(linter => 1);
|
||||
|
||||
lint(
|
||||
fails => 1,
|
||||
expect_filename => $Self->{golden_filename},
|
||||
);
|
||||
|
||||
ok(1);
|
||||
1;
|
20
test_regress/t/t_assoc_nokey_bad.v
Normal file
20
test_regress/t/t_assoc_nokey_bad.v
Normal file
@ -0,0 +1,20 @@
|
||||
// DESCRIPTION: Verilator: Verilog Test module for SystemVerilog 'alias'
|
||||
//
|
||||
// Simple bi-directional alias test.
|
||||
//
|
||||
// This file ONLY is placed under the Creative Commons Public Domain, for
|
||||
// any use, without warranty, 2024 by Wilson Snyder.
|
||||
// SPDX-License-Identifier: CC0-1.0
|
||||
|
||||
module t (/*AUTOARG*/);
|
||||
|
||||
initial begin
|
||||
int dict[string] = '{1, 2};
|
||||
int dict2[string] = '{3: 4}; // Legal due to value-to-string conversion
|
||||
$display("dict=%p", dict);
|
||||
$display("dict2=%p", dict2);
|
||||
$write("*-* All Finished *-*\n");
|
||||
$finish;
|
||||
end
|
||||
|
||||
endmodule
|
Loading…
Reference in New Issue
Block a user