I used the collapse clause of OpenMP to work with a doubly nested loop as follows: unsigned int iMax(10); #pragma omp parallel for schedule(dynamic,1) shared(iMax) private(i, j) collapse(2) for( i = 1; i < 4; i++ ) { for( j = 0; j <= iMax - i; j++ ) { } } The above code, which seems to work, create the following warning: warning: ‘i’ is used uninitialized in this function [-Wuninitialized] Is it normal?
With gcc 6.1.1, the above code gives rise to the error: error: condition expression refers to iteration variable ‘i’ So I suppose my syntax was incorrect. It is annoying tough.
(In reply to Rafael Guglielmetti from comment #1) > With gcc 6.1.1, the above code gives rise to the error: > error: condition expression refers to iteration variable ‘i’ > > So I suppose my syntax was incorrect. It is annoying tough. Do you have a version of your code that avoids that error? I get it, too, and so I can't reproduce the warning with that error there... WAITING on a valid testcase.
(In reply to Eric Gallager from comment #2) > (In reply to Rafael Guglielmetti from comment #1) > > With gcc 6.1.1, the above code gives rise to the error: > > error: condition expression refers to iteration variable ‘i’ > > > > So I suppose my syntax was incorrect. It is annoying tough. > > Do you have a version of your code that avoids that error? I get it, too, > and so I can't reproduce the warning with that error there... WAITING on a > valid testcase. I think I did something else but I don't remember how I avoid this problem, sorry.
(In reply to Rafael Guglielmetti from comment #3) > (In reply to Eric Gallager from comment #2) > > (In reply to Rafael Guglielmetti from comment #1) > > > With gcc 6.1.1, the above code gives rise to the error: > > > error: condition expression refers to iteration variable ‘i’ > > > > > > So I suppose my syntax was incorrect. It is annoying tough. > > > > Do you have a version of your code that avoids that error? I get it, too, > > and so I can't reproduce the warning with that error there... WAITING on a > > valid testcase. > > I think I did something else but I don't remember how I avoid this problem, > sorry. Okay, I'm closing this then, feel free to reopen if you ever do remember