I have a program that uses the following OpenMP directives together: taskloop and collapse. The program works fine when I compile with GCC 7.2, but it simply crashes when I compile with Intel compiler v 17.0.1. I investigated my code and I created a simple program that reproduces the cause of the crash. The code is below
int main ()
{
double * a=(double *) malloc(100*sizeof(double));
printf("1. a %x\n",a);
#pragma omp taskloop collapse(3) shared(a)
for(int i=0;i<1;i++)
{
for(int j=0;j<1;j++)
{
for (int k=0;k<1;k++)
{
printf("2. a %x\n",a);
double sum=0;
for(int l=0;l<5;l++)
{
sum+=1;
}
printf("%f\n",sum);
}
}
}
free(a);
}
For gcc, the output is correct
1. a 11610a0
2. a 11610a0 i 0 j 0 k 0
5.000000
For Intel v 17, the output is wrong
1. a d2e010
I compiled the same code with Intel version 18, the output is correct and similar to GCC.7.2
1. a 202f010
2. a 202f010 i 0 j 0 k 0
5.000000
In another complex code, I also found that the value of the pointers that are shared (like the Pointer "a" in the code above) are always changed to be zero also sometimes the indices (like i, j, k in the code above) of the collapsed loops have large negative numbers?
My question
Is there any fix for such bugs for version 17?