[llvm-bugs] [Bug 49098] New: firstprivate of declare target variable

via llvm-bugs llvm-bugs at lists.llvm.org
Mon Feb 8 15:15:16 PST 2021


https://bugs.llvm.org/show_bug.cgi?id=49098

            Bug ID: 49098
           Summary: firstprivate of declare target variable
           Product: OpenMP
           Version: unspecified
          Hardware: All
                OS: All
            Status: NEW
          Severity: normal
          Priority: P
         Component: Clang Compiler Support
          Assignee: unassignedclangbugs at nondot.org
          Reporter: kli at ca.ibm.com
                CC: llvm-bugs at lists.llvm.org

The explicit firstprivate clause should be respected on the target construct. 
In this case, clang seems to reference the mapped 'ga' instead of the
firstprivate 'ga'.

#include <stdio.h>

#pragma omp declare target
int ga = 5;
#pragma omp end declare target

int main() {
  ga = 100;

#pragma omp target firstprivate(ga)
  {
    ga += 10;
    printf("on device, ga = %d\n", ga);
  }
  printf("on host, ga = %d\n", ga);
  return 0;
}

Current output:
on device, ga = 15
on host, ga = 100

Expected output:
on device, ga = 110
on host, ga = 100

-- 
You are receiving this mail because:
You are on the CC list for the bug.
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.llvm.org/pipermail/llvm-bugs/attachments/20210208/39f9124b/attachment.html>


More information about the llvm-bugs mailing list