From 6155986d1c7905ce3f7cdae7169aed0932b97933 Mon Sep 17 00:00:00 2001 From: Martin Whitaker Date: Mon, 11 Jul 2016 20:04:24 +0100 Subject: [PATCH] Fix for br1005 - segfault when SV queue is declared inside a class. For now, output a "sorry" message to indicate this is not yet supported. (cherry picked from commit ad1101cc806a94d1a871c9fdbd15f667cff43dea) --- elab_type.cc | 14 +++++++++++++- pform_pclass.cc | 1 + 2 files changed, 14 insertions(+), 1 deletion(-) diff --git a/elab_type.cc b/elab_type.cc index eb2803cbf..4c1814909 100644 --- a/elab_type.cc +++ b/elab_type.cc @@ -1,5 +1,5 @@ /* - * Copyright (c) 2012-2014 Stephen Williams (steve@icarus.com) + * Copyright (c) 2012-2016 Stephen Williams (steve@icarus.com) * * This source code is free software; you can redistribute it * and/or modify it in source code form under the terms of the GNU @@ -17,11 +17,13 @@ * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. */ +# include "PExpr.h" # include "pform_types.h" # include "netlist.h" # include "netclass.h" # include "netdarray.h" # include "netenum.h" +# include "netqueue.h" # include "netparray.h" # include "netscalar.h" # include "netstruct.h" @@ -245,6 +247,16 @@ ivl_type_s* uarray_type_t::elaborate_type_raw(Design*des, NetScope*scope) const return res; } + // Special case: if the dimension is null:nil. this is a queue. + if (cur->second==0 && dynamic_cast(cur->first)) { + cerr << get_fileline() << ": sorry: " + << "SV queues inside classes are not yet supported." << endl; + des->errors += 1; + + ivl_type_s*res = new netqueue_t(btype); + return res; + } + vector dimensions; bool bad_range = evaluate_ranges(des, scope, dimensions, *dims); diff --git a/pform_pclass.cc b/pform_pclass.cc index bd2a7a21a..a3b7df4f0 100644 --- a/pform_pclass.cc +++ b/pform_pclass.cc @@ -79,6 +79,7 @@ void pform_class_property(const struct vlltype&loc, if (! curp->index.empty()) { list*pd = new list (curp->index); use_type = new uarray_type_t(use_type, pd); + FILE_NAME(use_type, loc); } pform_cur_class->type->properties[curp->name]