[Bug c++/71974] New: Warning: uninitialized variable with OpenMP nested loops

register at rgug dot ch gcc-bugzilla@gcc.gnu.org
Fri Jul 22 17:25:00 GMT 2016


https://gcc.gnu.org/bugzilla/show_bug.cgi?id=71974

            Bug ID: 71974
           Summary: Warning: uninitialized variable with OpenMP nested
                    loops
           Product: gcc
           Version: 4.8.4
            Status: UNCONFIRMED
          Severity: normal
          Priority: P3
         Component: c++
          Assignee: unassigned at gcc dot gnu.org
          Reporter: register at rgug dot ch
  Target Milestone: ---

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?


More information about the Gcc-bugs mailing list