[cfe-dev] missing -Wuninitialized warnings with OpenMP

Zakharin, Vyacheslav P via cfe-dev cfe-dev at lists.llvm.org
Tue Jun 25 15:16:54 PDT 2019


Good! I submitted 42392<https://bugs.llvm.org/show_bug.cgi?id=42392>.

Thanks,
Slava

From: Finkel, Hal J. [mailto:hfinkel at anl.gov]
Sent: Tuesday, June 25, 2019 2:00 PM
To: Zakharin, Vyacheslav P <vyacheslav.p.zakharin at intel.com>; cfe-dev at lists.llvm.org
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

cfe-dev at lists.llvm.org<mailto:cfe-dev at lists.llvm.org>

https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-dev

--

Hal Finkel

Lead, Compiler Technology and Programming Languages

Leadership Computing Facility

Argonne National Laboratory
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.llvm.org/pipermail/cfe-dev/attachments/20190625/98f6c735/attachment.html>


More information about the cfe-dev mailing list