<table border="1" cellspacing="0" cellpadding="8">
<tr>
<th>Issue</th>
<td>
<a href=https://github.com/llvm/llvm-project/issues/62099>62099</a>
</td>
</tr>
<tr>
<th>Summary</th>
<td>
Clang is unable to compile OpenMP target regions from stdin
</td>
</tr>
<tr>
<th>Labels</th>
<td>
openmp,
clang:frontend
</td>
</tr>
<tr>
<th>Assignees</th>
<td>
</td>
</tr>
<tr>
<th>Reporter</th>
<td>
skatrak
</td>
</tr>
</table>
<pre>
Clang emits an error when compiling from standard input if an OpenMP target region is present and `-fopenmp` is specified. This is most likely related to the use of the input file name for constructing the name of an outlined function that's generated for each OpenMP target region.
Ideally, this use case should be supported, since it is possible to compile from stdin when no target regions are present or OpenMP support is disabled. However, if that proves to be problematic, at least a more informative error message would be useful.
Test code:
```
$ cat test.cpp
int main() {
#pragma omp target
{}
}
```
Program arguments:
```
$ cat test.cpp | clang -cc1 -fopenmp -emit-llvm -disable-llvm-passes -
```
Output:
```
fatal error: cannot open file '<stdin>': No such file or directory
1 error generated.
```
</pre>
<img width="1px" height="1px" alt="" src="http://email.email.llvm.org/o/eJyMlMFu4zgPx59GvhAJbDlN4oMPnfQLvj3szhzmBWiJtrWVJUOkW_TtF7Ld7nbQBRYIEokk-Cd_IYXMbghErXr4ph6eClxkjKnlZ5SEz0UX7Vt78xgGoMkJAwaglGKC15ECmDjNzrswQJ_iBCwYLCYLLsyLgOtz-PeZwu8_QDANJJBocDGAY5gTMQUBDBbUuTz0caYwzepcZi_PZFzvyB7h5-g4m6bIAt49k3-DRB6FLEgEGQkWJoj9etyke-cJAk4EfUxgYmBJi5FcaQ5aPXEtLy7iXSAL_RKM5NpkRFH6wjBQoLTK5CSEZvyymaMqn1T5uH3_Zgm9f1P6BpLrzpUZZAIe4-ItdAS8zHNMQjYHsQuGwMlKJDK7zlPuaiNL71ytCxvxED-LM2CiD5YxvVe4i-S01jF2PpP8f3ylF0pZ1_VrnzCn-EKcFbucJnaeJhRncgwKeEIWQJhiymj7mLL3hfYhmIgZB4LX994Wpn7xn4j8JBYw0ZKqd4s6l_tnu-oTGBQQYjmaed6sLghM6ILSV6UbUJdvmx2UrueEw4QQp3mHsbvWqMvTnvbj8FnuR4pDwgkwDctEQfi_1gXqcgOz7sLBmAreJxYOeTUO3r9McNhhr7fDjMzEcPgy_fdF5kX-TbxHQb9RVvUjGAwhCmTBbbaVvqj6tg6Gqv-33h7hjwi8mHGLiAmsS2QkprctZ7X_ax9zffxFurBtbZu6wYLa6nyt6qopy4dibPW5Pl2vTWP7srNXezaXK9VEeK4aU1Z9U7hWl7ouT5WuLmWtH45d31VY6dqe6-5CdFKnkiZ0_pjBHGMaCse8UHvWZdMUHjvyvL5BWu_vgNZK35TWK3FVP_YpBqFgs-PhqUjtirhbBlan0jsW_ju3OPG0v1t5CQP-slZf7TH_Y9mKJfl2FJnX6dB3pe-Dk3HpjiZOSt-z0v5zmFP8k4wofV9bYqXva1d_BQAA__9PXr2K">