llvm-project
llvm-project copied to clipboard
firstprivate of declare target variable
| Bugzilla Link | 49098 |
| Resolution | FIXED |
| Resolved on | Apr 28, 2021 05:47 |
| Version | unspecified |
| OS | All |
| CC | @alexey-bataev,@jdoerfert |
| Fixed by commit(s) | c835630c25a4f9925517949579f66a43b113fbc9 |
Extended Description
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