missing -Wuninitialized warnings with OpenMP

classic Classic list List threaded Threaded
3 messages Options
Reply | Threaded
Open this post in threaded view
|

missing -Wuninitialized warnings with OpenMP

Nathan Ridge via cfe-dev

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


_______________________________________________
cfe-dev mailing list
[hidden email]
https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-dev
Reply | Threaded
Open this post in threaded view
|

Re: missing -Wuninitialized warnings with OpenMP

Nathan Ridge via cfe-dev


On 6/24/19 3:27 PM, Zakharin, Vyacheslav P via cfe-dev wrote:

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


_______________________________________________
cfe-dev mailing list
[hidden email]
https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-dev
-- 
Hal Finkel
Lead, Compiler Technology and Programming Languages
Leadership Computing Facility
Argonne National Laboratory

_______________________________________________
cfe-dev mailing list
[hidden email]
https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-dev
Reply | Threaded
Open this post in threaded view
|

Re: missing -Wuninitialized warnings with OpenMP

Nathan Ridge via cfe-dev

Good! I submitted 42392.

 

Thanks,

Slava

 

From: Finkel, Hal J. [mailto:[hidden email]]
Sent: Tuesday, June 25, 2019 2:00 PM
To: Zakharin, Vyacheslav P <[hidden email]>; [hidden email]
Subject: Re: [cfe-dev] missing -Wuninitialized warnings with OpenMP

 

 

On 6/24/19 3:27 PM, Zakharin, Vyacheslav P via cfe-dev wrote:

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



_______________________________________________
cfe-dev mailing list
[hidden email]
https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-dev
-- 
Hal Finkel
Lead, Compiler Technology and Programming Languages
Leadership Computing Facility
Argonne National Laboratory

_______________________________________________
cfe-dev mailing list
[hidden email]
https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-dev