Bug 105082 - [OpenMP] [RFC] Add warning like LLVM's "declaration marked as declare target after first use, it may lead to incorrect results [-Wopenmp-target]" ?
Summary: [OpenMP] [RFC] Add warning like LLVM's "declaration marked as declare target ...
Status: UNCONFIRMED
Alias: None
Product: gcc
Classification: Unclassified
Component: middle-end (show other bugs)
Version: 12.0
: P3 normal
Target Milestone: ---
Assignee: Not yet assigned to anyone
URL:
Keywords: diagnostic, openmp
Depends on:
Blocks: new-warning, new_warning
  Show dependency treegraph
 
Reported: 2022-03-28 13:31 UTC by Tobias Burnus
Modified: 2022-03-28 18:42 UTC (History)
1 user (show)

See Also:
Host:
Target:
Build:
Known to work:
Known to fail:
Last reconfirmed:


Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description Tobias Burnus 2022-03-28 13:31:55 UTC
According to https://github.com/SOLLVE/sollve_vv/issues/506 , LLVM has the following '-Wopenmp-target' warning.

RFC: Add a similar warning to warn_omp_declare_target_after_first_use ?
( https://github.com/llvm/llvm-project/commit/729e242a7972f4802f982a4b4dabb964aa299675 )


warning: declaration marked as declare target after first use, it may lead to incorrect results [-Wopenmp-target]
#pragma omp declare target link(a,b,c,i)


for code like:


int a[N], b[N], c[N];
int i = 0;

void update() {
  for (i = 0; i < N; i++) {
    a[i] += 1;
    b[i] += 2;
    c[i] += 3;
  }
}

#pragma omp declare target 
#pragma omp declare target link(a,b,c,i)  
#pragma omp declare target to(update)  
#pragma omp end declare target