When I extend (working) code using a do/while and a fo loop by an if /then /else clause, the compiler crashes
do
{
x++;
for(z=0; z<3; z++)
{
if(z == 0)
{
syntype = (int)layer_resource_synt
pre_index = (int)layer_resource_ind
c = layer_resource_str
intern_zv2_adapt = zv2_adapt.x;
intern_zv2_mp = zv2_mp.x;
intern_zv2_act = zv2_ac.x;
}
else if(z== 1)
{
..some more code
}
else if(z == 2)
{
..some more code
}
else if(z == 3)
{
..some more code
}
// THIS CRASHES THE COMPILER
if(pre_index > -1)
{
isFinished = 1;
}
// WORKS WELL WITHOUT IT (except it's an endless loop of course...
} // end for
}while (isFinished != 1);
RESULT: access violation in the amdcalrt.dll
Now I am willing to do without switch/case, I can even accept crashes if I insert a "break"-statement in the do/while-loop, and the missing goto, which would be very useful here, is also not a real problem, but if-statements are rather hard to replace.
I have a temporary workaround where I call kernel functions for the do- and the for-loop, separating the if-clauses and this works but that's not really nice, is it?
Anybody have any ideas?
Which catalyst version/OS are you using?
I use the VisualStudio 6 under Windows XP professional, where we integrated the bcc compiler. I downloaded the StreamKernelAnalyze in its lates version (1.2, I believe) to check the syntax, which produces exactly the same error.
brcc doesn't use amdcalrt library. Do you see this error at compile time or when you run this kernel?
The crash happens at compile time (we start the CPU side of the program then load the GPU kernel program as a string and compile/link it). Since we have a relatively complicated type of input and output data we do the whole setup for the kernel using the cal...()-Routines. The crash happens at:
if( calclCompile(&m_obj, lang, m_testshader, attribs.target) != CAL_RESULT_OK)
{
comperror = calclGetErrorString();
AfxMessageBox(comperror,MB_OK,0);
return ;
}
with "m_testshader" being the code string.
( we don't get the error return code, the call crashes)
Thank you for your effort
Can you post your IL code? What is your driver version?