From 12728bc4780d737950442b2d009602fbd2d2f246 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Felix=20Neum=C3=A4rker?= Date: Fri, 3 Mar 2023 18:54:38 -0500 Subject: [PATCH] Fix UNDRIVEN warning seg fault (#3989) --- Changes | 1 + src/V3Undriven.cpp | 3 ++- ...ys_comb_multidriven_compile_public_flat.pl | 22 +++++++++++++++++++ 3 files changed, 25 insertions(+), 1 deletion(-) create mode 100755 test_regress/t/t_lint_always_comb_multidriven_compile_public_flat.pl diff --git a/Changes b/Changes index 4288bef85..0f533c39e 100644 --- a/Changes +++ b/Changes @@ -61,6 +61,7 @@ Verilator 5.007 devel * Fix subsequent parameter declarations (#3969). [Ryszard Rozak, Antmicro Ltd] * Fix timing delays to not truncate below 64 bits (#3973) (#3982). [Felix Neumärker] * Fix cmake on macOS to mark weak symbols with -U linker flag (#3978) (#3979). [Peter Debacker] +* Fix UNDRIVEN warning seg fault (#3989). [Felix Neumärker] * Fix packed array structure replication. * Fix enum.next(0) and enum.prev(0). diff --git a/src/V3Undriven.cpp b/src/V3Undriven.cpp index 2b3973ecc..398abf29a 100644 --- a/src/V3Undriven.cpp +++ b/src/V3Undriven.cpp @@ -408,7 +408,8 @@ private: } if (entryp->isDrivenWhole() && !m_inBBox && !VN_IS(nodep, VarXRef) && !VN_IS(nodep->dtypep()->skipRefp(), UnpackArrayDType) - && nodep->fileline() != entryp->getNodeFileLinep() && !entryp->isUnderGen()) { + && nodep->fileline() != entryp->getNodeFileLinep() && !entryp->isUnderGen() + && entryp->getNodep()) { if (m_alwaysCombp && (!entryp->isDrivenAlwaysCombWhole() || (entryp->isDrivenAlwaysCombWhole() diff --git a/test_regress/t/t_lint_always_comb_multidriven_compile_public_flat.pl b/test_regress/t/t_lint_always_comb_multidriven_compile_public_flat.pl new file mode 100755 index 000000000..9cf2c191e --- /dev/null +++ b/test_regress/t/t_lint_always_comb_multidriven_compile_public_flat.pl @@ -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 2023 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(vlt => 1); + +top_filename("t/t_lint_always_comb_multidriven.v"); + +lint( + verilator_flags2 => ['--public-flat-rw --lint-only'], + fails => 1, + expect_filename => "t/t_lint_always_comb_multidriven.out", + ); + +ok(1); +1;