[PATCH] D84182: [OPENMP]Fix PR46012: declare target pointer cannot be accessed in target region.
George Rokos via Phabricator via cfe-commits
cfe-commits at lists.llvm.org
Fri Jul 24 16:28:12 PDT 2020
grokos added a comment.
@ABataev:
After this patch was committed, I tried to run the following example:
#include <stdio.h>
int *yptr;
int main() {
int y[10];
y[1] = 1;
yptr = &y[0];
printf("&yptr = %p\n", &yptr);
printf("&y[0] = %p\n", &y[0]);
#pragma omp target data map(to: yptr[0:5])
#pragma omp target
{
printf("y = %d\n", yptr[1]);
yptr[1] = 10;
printf("y = %d\n", yptr[1]);
}
printf("y = %d\n", yptr[1]);
return 0;
}
The arguments clang generates are:
1) base = &y[0], begin = &yptr, size = 8, type = TARGET_PARAM | TO
2) base = &yptr, begin = &y[0], size = 8, type = PTR_AND_OBJ | TO
The second argument is correct, the first argument doesn't make much sense. I believe it should have its base set to &yptr, not &y[0].
y[0] is not the base for anything, it's only the pointee object.
Repository:
rG LLVM Github Monorepo
CHANGES SINCE LAST ACTION
https://reviews.llvm.org/D84182/new/
https://reviews.llvm.org/D84182
More information about the cfe-commits
mailing list