intel / intel/llvm

`-fsycl` breaks `_OPENMP` preprocessor definition

Open
#10,711 4 comments 0 reactions 0 assignees View on GitHub
bug confirmed
Dominant language
LLVM
Stars
1.5k
Forks
854
Avg merge
3d 17h
Merged PRs (30d)
137

Description

**Describe the bug**
Compiling a program which makes use of `_OPENMP` to check for the OpenMP version will result in a broken macro if `-fsycl` is used as a compilation flag.

**To Reproduce**
```c++
#include

#if _OPENMP < 200203
#error Oops!
#endif

auto main() -> int
{
std::cout << "OpenMP version: " << _OPENMP << std::endl;
}
```

Without SYCL:

```
icpx -std=c++17 -fiopenmp
OpenMP version: 201811
```

With SYCL:

```
icpx -std=c++17 -fsycl -fiopenmp
:4:2: error: Oops!
#error Oops!
^
:9:40: error: use of undeclared identifier '_OPENMP'
std::cout << "OpenMP version: " << _OPENMP << std::endl;
^
2 errors generated.
Compiler returned: 1
```

See it [here](https://godbolt.org/z/4j671jT1v) on godbolt.

Contributor guide

Open the contributing guide

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.