From 31eef61e8d5cd13f0ddab381ec76a7caa73a0ecd Mon Sep 17 00:00:00 2001 From: Cary R Date: Fri, 4 Sep 2026 15:46:54 -0700 Subject: [PATCH] Report when the task port return type does not match the connection --- elaborate.cc | 16 +++++++++++++--- ivtest/gold/br_gh716.gold | 3 +++ ivtest/ivltests/br_gh716.v | 10 ++++++++++ ivtest/regress-sv.list | 1 + 4 files changed, 27 insertions(+), 3 deletions(-) create mode 100644 ivtest/gold/br_gh716.gold create mode 100644 ivtest/ivltests/br_gh716.v diff --git a/elaborate.cc b/elaborate.cc index 29346a9cc..ece7ac2e9 100644 --- a/elaborate.cc +++ b/elaborate.cc @@ -4915,9 +4915,19 @@ NetProc* PCallTask::elaborate_build_call_(Design*des, NetScope*scope, rv = cast_to_int4(rv, lv_width); break; default: - /* Don't yet know how to handle this. */ - ivl_assert(*this, 0); - break; + cerr << get_fileline() << ": error: " + << "Argument " << (idx+1) << " for task '" + << task->basename() << "' is called with '"; + lv->dump_lval(cerr); + cerr << "' which has type '" + << lv->expr_type() << "'." << endl; + cerr << get_fileline() << ": : " + "The task expects to return type '" + << rv->expr_type() << "'." << endl; + des->errors += 1; + delete lv; + delete rv; + continue; } } rv = pad_to_width(rv, lv_width, *this); diff --git a/ivtest/gold/br_gh716.gold b/ivtest/gold/br_gh716.gold new file mode 100644 index 000000000..e79412748 --- /dev/null +++ b/ivtest/gold/br_gh716.gold @@ -0,0 +1,3 @@ +./ivltests/br_gh716.v:8: error: Argument 1 for task 't1' is called with 'bf' which has type 'darray'. +./ivltests/br_gh716.v:8: : The task expects to return type 'logic'. +1 error(s) during elaboration. diff --git a/ivtest/ivltests/br_gh716.v b/ivtest/ivltests/br_gh716.v new file mode 100644 index 000000000..84ef7cc9d --- /dev/null +++ b/ivtest/ivltests/br_gh716.v @@ -0,0 +1,10 @@ +module test(); + logic [7:0] bf []; + + task t1(output logic [7:0] buffer); + buffer=0; + endtask + + initial t1(bf); + +endmodule diff --git a/ivtest/regress-sv.list b/ivtest/regress-sv.list index aa5089d5d..16743dbaa 100644 --- a/ivtest/regress-sv.list +++ b/ivtest/regress-sv.list @@ -148,6 +148,7 @@ br_gh4a normal,-g2009 ivltests br_gh72a normal,-g2009 ivltests gold=br_gh72a.gold br_gh72b normal,-g2009 ivltests gold=br_gh72b.gold br_gh72b_fail CE,-g2009 ivltests gold=br_gh72b_fail.gold +br_gh716 CE,-g2009 ivltests gold=br_gh716.gold br_gh104a normal,-g2009 ivltests br_gh104b normal,-g2009 ivltests br_gh105a normal,-g2009 ivltests gold=br_gh105a.gold