| Issue |
71271
|
| Summary |
[clang][openmp] declare target + threadprivate crashes compiler
|
| Labels |
clang:openmp
|
| Assignees |
|
| Reporter |
shraiysh
|
I stumbled upon this while trying to understand threadprivate and implementing some checks for the flang compiler. The reproducer for the crash:
```
void foo(int);
int x;
#pragma omp declare target(x)
#pragma omp threadprivate(x)
int main() {
#pragma omp parallel
{
foo(x);
}
}
```
```
$ clang -S -emit-llvm -O3 sample.cpp
```
Expected behavior:
An valid semantic error is reported if the order of threadprivate and declare target is reversed. This is the expected behavior.
```
sample.cpp:3:5: error: threadprivate variables cannot be used in target constructs
3 | int x;
| ^
sample.cpp:5:27: note: defined as threadprivate or thread local
5 | #pragma omp threadprivate(x)
| ^
```
_______________________________________________
llvm-bugs mailing list
[email protected]
https://lists.llvm.org/cgi-bin/mailman/listinfo/llvm-bugs