missing -Wuninitialized warnings with OpenMP

Hello,

Is it possible to get appropriate -Wuninitialized warnings with OpenMP for the following cases?

int reduction(int *input) {

int i, r;

#pragma omp target parallel for map(to: input) reduction(+: r)

for (i = 0; i < 100; ++i)

r += input[i];

return r;

}

int linear() {

int i, r;

#pragma omp target parallel for linear(r)

for (i = 0; i < 100; ++i)

r += 1;

return r;

}

void firstprivate(int *input) {

int r;

#pragma omp target firstprivate(r) map(tofrom: input[0:1])

*input = r;

}

It compiles silently with -fopenmp, but the errors become obvious w/o it:

warn.c:5:5: warning: variable ‘r’ is uninitialized when used here [-Wuninitialized]

warn.c:14:5: warning: variable ‘r’ is uninitialized when used here [-Wuninitialized]

warn.c:21:12: warning: variable ‘r’ is uninitialized when used here [-Wuninitialized]

Is it worth a tracker?

Thanks,

Slava

Hello,

Is it possible to get appropriate -Wuninitialized warnings with OpenMP for the following cases?

int reduction(int *input) {
  int i, r;
#pragma omp target parallel for map(to: input) reduction(+: r)
  for (i = 0; i < 100; ++i)
    r += input[i];

  return r;
}

int linear() {
  int i, r;
#pragma omp target parallel for linear(r)
  for (i = 0; i < 100; ++i)
    r += 1;

  return r;
}
void firstprivate(int *input) {
  int r;
#pragma omp target firstprivate(r) map(tofrom: input[0:1])
  *input = r;
}

It compiles silently with -fopenmp, but the errors become obvious w/o it:
warn.c:5:5: warning: variable 'r' is uninitialized when used here [-Wuninitialized]
warn.c:14:5: warning: variable 'r' is uninitialized when used here [-Wuninitialized]
warn.c:21:12: warning: variable 'r' is uninitialized when used here [-Wuninitialized]

Is it worth a tracker?

Yes, I think that filing a bug would be useful.

Thanks again,

Hal

Thanks,
Slava

Good! I submitted 42392.

Thanks,

Slava