Prevent internal error on pattern mismatch
This commit is contained in:
parent
ed6687359b
commit
542ffcca60
|
|
@ -4764,7 +4764,7 @@ class WidthVisitor final : public VNVisitor {
|
|||
E_UNSUPPORTED,
|
||||
"Unsupported: Assignment pattern applies against non struct/union data type: "
|
||||
<< dtypep->prettyDTypeNameQ());
|
||||
nodep->unlinkFrBack();
|
||||
nodep->replaceWith(new AstConst{nodep->fileline(), AstConst::BitFalse{}});
|
||||
}
|
||||
|
||||
// Done with the Pattern
|
||||
|
|
|
|||
|
|
@ -0,0 +1,6 @@
|
|||
%Error-UNSUPPORTED: t/t_array_pattern_scalar_bad.v:9:13: Unsupported: Assignment pattern applies against non struct/union data type: 'bit'
|
||||
: ... note: In instance 't'
|
||||
9 | bit bad = '{1'b1};
|
||||
| ^~
|
||||
... For error description see https://verilator.org/warn/UNSUPPORTED?v=latest
|
||||
%Error: Exiting due to
|
||||
|
|
@ -0,0 +1,16 @@
|
|||
#!/usr/bin/env python3
|
||||
# DESCRIPTION: Verilator: Verilog Test driver/expect definition
|
||||
#
|
||||
# Copyright 2025 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('linter')
|
||||
|
||||
test.lint(fails=True, expect_filename=test.golden_filename)
|
||||
|
||||
test.passes()
|
||||
|
|
@ -0,0 +1,12 @@
|
|||
// DESCRIPTION: Verilator: Verilog Test module
|
||||
//
|
||||
// This file ONLY is placed under the Creative Commons Public Domain, for
|
||||
// any use, without warranty, 2025 by Wilson Snyder.
|
||||
// SPDX-License-Identifier: CC0-1.0
|
||||
|
||||
module t;
|
||||
|
||||
bit bad = '{1'b1}; // <--- BAD: Can't assign pattern to scalar
|
||||
|
||||
initial $stop;
|
||||
endmodule
|
||||
Loading…
Reference in New Issue