<table border="1" cellspacing="0" cellpadding="8">
<tr>
<th>Issue</th>
<td>
<a href=https://github.com/llvm/llvm-project/issues/86791>86791</a>
</td>
</tr>
<tr>
<th>Summary</th>
<td>
Compilation error on omp threadprivate when -fopenmp-targets=amdgcn-amd-amdhsa
</td>
</tr>
<tr>
<th>Labels</th>
<td>
clang:codegen,
crash,
clang:openmp
</td>
</tr>
<tr>
<th>Assignees</th>
<td>
</td>
</tr>
<tr>
<th>Reporter</th>
<td>
fel-cab
</td>
</tr>
</table>
<pre>
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)
</pre>
<img width="1px" height="1px" alt="" src="http://email.email.llvm.org/o/eJyUU8-PrDYM_mvCxZoRJDDAgcPOjuihh_aw6nUViIHshgQlZra7f30V5le17dPTk2YMNo79ffYXGYIeLWLDiiMrTolcaXK-GdDsetklnVOfzcuEMDhj3Ie2I_ROIRNPLD2x9Ikd0utvc7Ul-M24Tpq_pGfieE3iYvFynCW4eQGaPEq1eH2WhIxXj3xeP6rMUlvGK8ZrYOW1DgA8qgMTJ8gePcrT_yKaiJYQ4fKW8XZ0qnOG9s6PjLdfjLf2C38vuiJ7u57e7B8WaEIIn4FwZvx589B758ENm9O7edEGPejwo1m0q-1JOwseafUW6HNBUA4DWBf5UT-BW9BLqy7f3HBL1TYQ49mNtUeChTxIpXxYZB-nlm2T4cUtaSE_SJLmApOJpytebaGT_TtaFWNH797RwuzUauJOV6sivQsbuaGVnfOE6t6-N9KO93rxZYvA4J0ltCoeniOHQWqDCj40TYB_a9qEAmUKjFdrQNidgRwERND27Pqt233l32bHiuOs7QsGeqXNyPD--jJ59edFNvsvvbDixHj1bb-aprXb925mvDXmfHvsFu_esCfG20EbDIy3WV6W_BAV1v681R3mZhPVCFWLWibYZGWWFaKuSpFMTV4fciEG1QveocJDX5Ylqqqo07KSUnSJbnjK81TwMsvyXIh9zg912neZqAdVDPWB5SnOUpt9RB1lmugQVmyqQ1lniZEdmrBdVc5vi4ljHtEyzhl_jnEvw_TwrlluQTsvMVycEt9sQ-nWMbA8NTpQeDQkTQab539J4qp8-9_rCx8TWtgNl-o7kn5ECkyc5KzG3u7krOJ_CjJZvWl-eVkb-bitjf8_AQAA__8AZnmM">