Skip to content
Snippets Groups Projects
Commit b236d437 authored by Ben Franksen's avatar Ben Franksen
Browse files

snc: fixed compiler crash in case of excess PVs given in an assign clause

Funny, I had an assertion in the code that should have caught the bug
but unfortunately the assertion itself had an off-by-one error and so
didn't fire. So I had to debug this the hard way. The compiler will now
give a warning message saying that it discards the excess PV names.
parent 98a45fe8
No related branches found
No related tags found
No related merge requests found
......@@ -415,7 +415,7 @@ static void assign_elem(
assert(chan_list); /* precondition */
assert(defn); /* precondition */
assert(vp); /* precondition */
assert(n_subscr <= type_array_length1(vp->type));/*precondition */
assert(n_subscr < type_array_length1(vp->type));/*precondition */
assert(vp->assign != M_SINGLE); /* precondition */
if (vp->assign == M_NONE)
......@@ -518,6 +518,12 @@ static void assign_multi(
#ifdef DEBUG
report("'%s'%s", pv_name->value, pv_name->next ? ", " : "};\n");
#endif
if (n_subscr >= type_array_length1(vp->type))
{
warning_at_expr(pv_name, "discarding excess PV names "
"in multiple assign to variable '%s'\n", vp->name);
break;
}
assign_elem(chan_list, defn, vp, n_subscr++, pv_name->value);
}
/* for the remaining array elements, assign to "" */
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment