Fix #716: Report error for incompatible task argument types
When an undimensioned (dynamic) array was passed to a task parameter expecting a simple vector, the compiler would crash with an assertion failure because the switch handling type casts didn't know how to handle IVL_VT_DARRAY type. Changed the assertion to emit a proper error message about type incompatibility and continue processing, allowing the compiler to report the error gracefully instead of crashing. Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
This commit is contained in:
parent
25e259e495
commit
6853bad106
12
elaborate.cc
12
elaborate.cc
|
|
@ -4340,9 +4340,15 @@ 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;
|
||||
/* Cannot cast between these types. */
|
||||
cerr << get_fileline() << ": error: "
|
||||
<< "Type of task port " << (idx+1)
|
||||
<< " is not compatible with the argument type."
|
||||
<< endl;
|
||||
des->errors += 1;
|
||||
delete rv;
|
||||
delete lv;
|
||||
continue;
|
||||
}
|
||||
}
|
||||
rv = pad_to_width(rv, lv_width, *this);
|
||||
|
|
|
|||
|
|
@ -0,0 +1,2 @@
|
|||
./ivltests/br_gh716.v:11: error: Type of task port 1 is not compatible with the argument type.
|
||||
1 error(s) during elaboration.
|
||||
|
|
@ -0,0 +1,13 @@
|
|||
// Test for GitHub issue #716
|
||||
// Undimensioned array passed to task expecting single vector should error
|
||||
module test();
|
||||
logic [7:0] mybuf [];
|
||||
|
||||
task t1(output logic [7:0] buffer);
|
||||
buffer = 0;
|
||||
endtask
|
||||
|
||||
initial begin
|
||||
t1(mybuf);
|
||||
end
|
||||
endmodule
|
||||
|
|
@ -223,6 +223,7 @@ br_gh661a normal,-g2009 ivltests
|
|||
br_gh661b normal,-g2009 ivltests
|
||||
br_gh672 normal,-g2009 ivltests
|
||||
br_gh699 CE,-g2009 ivltests
|
||||
br_gh716 CE,-g2012 ivltests gold=br_gh716.gold
|
||||
br_gh756 normal,-g2009 ivltests
|
||||
br_gh782a normal,-g2009 ivltests gold=br_gh782a.gold
|
||||
br_gh782b normal,-g2009 ivltests gold=br_gh782b.gold
|
||||
|
|
|
|||
Loading…
Reference in New Issue