Crash with a for-loop with a variable iteration count and a barrier
Affects | Status | Importance | Assigned to | Milestone | |
---|---|---|---|---|---|
pocl |
Fix Released
|
Critical
|
Pekka Jääskeläinen |
Bug Description
this is the regression test for-with-
"kernel \n"
"void test_kernel(
" __global int *result,\n"
" int a) {\n"
" int gid = get_global_
" int i;\n"
" float sum = 0.0f;\n"
" for (i = 0; i < a; ++i) {\n"
" sum += input[i]; \n"
" barrier(
" }\n"
" result[gid] = sum;\n"
"}\n";
This causes a branch from the first block to the exit block of the kernel function because a can be zero which causes the whole for-loop to be jumped over. That branch is not reproduced by pocl thus causing a crash because of invalid phi-nodes in the block preceeding the exit:
PHINode should have one entry for each predecessor of its parent basic block!
%sum.0.lcssa = phi i32 [ %phitmp, %for.cond.
PHINode should have one entry for each predecessor of its parent basic block!
%sum.
PHINode should have one entry for each predecessor of its parent basic block!
%14 = phi i32 [ %phitmp, %for.cond.
PHINode should have one entry for each predecessor of its parent basic block!
%18 = phi i32 [ %phitmp.wi_1_0_0, %for.end.
Broken module found, compilation aborted!
This still crashes but in another position. Checking...