Hide Forgot
When trying a loop collapse with gcc 4.8.1 I get warnings about unitialized internal variables. Reduced test case: #include <cstdlib> #include <vector> #include <cstdio> int main(void) { size_t N=10; #ifdef _OPENMP #pragma omp parallel for collapse(2) #endif for(size_t iix=0;iix<N;iix++) for(size_t iiy=0;iiy<N;iiy++) printf("%i\n",(int) (iix+iiy*iiy)); return 0; } No errors arise with -Wall -fopenmp, but with added -O2 $ g++ -O2 -Wall -fopenmp test.cpp test.cpp: In function ‘<built-in>’: test.cpp:11:3: warning: ‘.count.6’ may be used uninitialized in this function [-Wmaybe-uninitialized] for(size_t iix=0;iix<N;iix++) ^ test.cpp:11:3: note: ‘.count.6’ was declared here for(size_t iix=0;iix<N;iix++) ^ test.cpp:11:3: warning: ‘.count.7’ may be used uninitialized in this function [-Wmaybe-uninitialized] for(size_t iix=0;iix<N;iix++) ^ test.cpp:11:3: note: ‘.count.7’ was declared here for(size_t iix=0;iix<N;iix++) ^
If you remove the collapse statement, the uninitialized variable doesn't appear.
Fixed upstream, will propagate to F19 when F19 gcc is errataed (in a few weeks).