Fix crash when super.new() called without a base class (#6772)
This commit is contained in:
parent
040484cc3f
commit
0e03ab2a57
|
|
@ -4851,7 +4851,7 @@ class LinkDotResolveVisitor final : public VNVisitor {
|
||||||
iterateChildren(nodep);
|
iterateChildren(nodep);
|
||||||
if (isNew) {
|
if (isNew) {
|
||||||
const AstClassExtends* const classExtendsp = VN_AS(m_modp, Class)->extendsp();
|
const AstClassExtends* const classExtendsp = VN_AS(m_modp, Class)->extendsp();
|
||||||
if (m_explicitSuperNewp && !m_explicitSuperNewp->isImplicit()
|
if (m_explicitSuperNewp && !m_explicitSuperNewp->isImplicit() && classExtendsp
|
||||||
&& classExtendsp->argsp()) {
|
&& classExtendsp->argsp()) {
|
||||||
m_explicitSuperNewp->v3error(
|
m_explicitSuperNewp->v3error(
|
||||||
"Explicit super.new not allowed with class "
|
"Explicit super.new not allowed with class "
|
||||||
|
|
|
||||||
|
|
@ -0,0 +1,5 @@
|
||||||
|
%Error: t/t_class_super_new_noextend_bad.v:10:12: 'super' used on non-extended class (IEEE 1800-2023 8.15)
|
||||||
|
10 | super.new();
|
||||||
|
| ^
|
||||||
|
... See the manual at https://verilator.org/verilator_doc.html?v=latest for more assistance.
|
||||||
|
%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
|
||||||
|
//
|
||||||
|
|
||||||
|
class Cls;
|
||||||
|
function new();
|
||||||
|
super.new(); // Bad - no extends
|
||||||
|
endfunction
|
||||||
|
endclass
|
||||||
Loading…
Reference in New Issue