Open
Description
Given the following action:
uint(size=8) pt[192] := [...data...];
action ==> OP:[pt[offset1+i]: for int i in 0 .. 15] repeat 16
var
int offset1 := 64,
uint(size=8) tempList[16]
do
tempList := [pt[i]: for int i in offset1 .. offset1+15];
end
The C-backend generates the following code for this two list generations:
// 1) For statement: tempList := [pt[i]: for int i in offset1 .. offset1+15];
i = offset1;
while (i <= offset1 + 15) {
tmp_pt = pt[i];
tempList[i] = tmp_pt;
i = i + 1;
}
// 2) For statement: OP:[pt[offset1+i]: for int i in 0 .. 15] repeat 16
i = offset1;
while (i <= 15) {
tmp_pt = pt[offset1+i];
tokens_OP[(index_OP % SIZE_OP) + (i)] = tmp_pt;
i = i + 1;
}
In both cases, index i (which is the index of the generator for) has also been used to populate the lvalue lists (tempList, tokensOP). This usage is fine, when the indexing in the for generator is starting from 0. But when the for generator is starting with some non-zero positive number, the index i mistakenly refers to a wrong location in the lvalue list, hence results in index of out bound exceptions.
Metadata
Metadata
Assignees
Labels
No labels