llvm / llvm-project

The LLVM Project is a collection of modular and reusable compiler and toolchain technologies.
http://llvm.org
Other
28.9k stars 11.94k forks source link

[Clang][OpenMP] Compilation error on omp threadprivate when -fopenmp-targets=amdgcn-amd-amdhsa #86791

Open fel-cab opened 7 months ago

fel-cab commented 7 months ago

The following code:

int GlobalVar;
#pragma omp threadprivate(GlobalVar)
int main() {
    GlobalVar = 1;
}

https://godbolt.org/z/nzeK5b51j

On the system, the error of the compiler is:

Function return type does not match operand type of return inst!
  ret ptr addrspace(1) %1
 ptrfatal error: error in backend: Broken module found, compilation aborted!
clang: error: clang frontend command failed with exit code 70 (use -v to see invocation)

minTest_test_task_ThrdPrivate.zip

llvmbot commented 7 months ago

@llvm/issue-subscribers-clang-codegen

Author: Felipe Cabarcas (fel-cab)

The following code: ``` int GlobalVar; #pragma omp threadprivate(GlobalVar) int main() { GlobalVar = 1; } ``` https://godbolt.org/z/nzeK5b51j On the system, the error of the compiler is: ``` Function return type does not match operand type of return inst! ret ptr addrspace(1) %1 ptrfatal error: error in backend: Broken module found, compilation aborted! clang: error: clang frontend command failed with exit code 70 (use -v to see invocation) ``` [minTest_test_task_ThrdPrivate.zip](https://github.com/llvm/llvm-project/files/14772628/minTest_test_task_ThrdPrivate.zip)