Bug 999674 - Uninitialized internal variable with OpenMP loop collapse
Uninitialized internal variable with OpenMP loop collapse
Status: CLOSED UPSTREAM
Product: Fedora
Classification: Fedora
Component: gcc (Show other bugs)
19
Unspecified Unspecified
unspecified Severity unspecified
: ---
: ---
Assigned To: Jakub Jelinek
Fedora Extras Quality Assurance
:
Depends On:
Blocks:
  Show dependency treegraph
 
Reported: 2013-08-21 16:10 EDT by Susi Lehtola
Modified: 2013-08-28 06:14 EDT (History)
2 users (show)

See Also:
Fixed In Version:
Doc Type: Bug Fix
Doc Text:
Story Points: ---
Clone Of:
Environment:
Last Closed: 2013-08-28 06:14:53 EDT
Type: Bug
Regression: ---
Mount Type: ---
Documentation: ---
CRM:
Verified Versions:
Category: ---
oVirt Team: ---
RHEL 7.3 requirements from Atomic Host:
Cloudforms Team: ---


Attachments (Terms of Use)


External Trackers
Tracker ID Priority Status Summary Last Updated
GNU Compiler Collection 58257 None None None Never

  None (edit)
Description Susi Lehtola 2013-08-21 16:10:17 EDT
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++)
   ^
Comment 1 Susi Lehtola 2013-08-21 16:26:32 EDT
If you remove the collapse statement, the uninitialized variable doesn't appear.
Comment 2 Jakub Jelinek 2013-08-28 06:14:53 EDT
Fixed upstream, will propagate to F19 when F19 gcc is errataed (in a few weeks).

Note You need to log in before you can comment on or make changes to this bug.