Join GitHub today
Internal error when task is used to assign subscripted vector #1387
Author Name: Al Grant
Original Assignee: Wilson Snyder (@wsnyder)
Strangely, this is sensitive to the vector size, and (for me) it stops happening if the '2' is changed to '3'. That might suggest sensitivity to uninitialized data but valgrind isn't showing anything.
Original Redmine Comment
The problem is internal code isn't treating the task reference as a statement; working on a fix as touches a lot of code.
You may workaround this issue by adding some statement around the task reference, e.g. "if (i>=0 || i<=2) T(a[i]);"
This error doesn't occur when you use 3:0 because it's now a power of two so there's no test needed to suppress the array assignment if i=3.
This code is race-free in Verilator, but caution that this code is nondeterministic and may race in simulators that predate SystemVerilog 2012, as "integer i=0" is not guaranteed to happen before the initial block uses it.