8000 `NAN` is not `constexpr` anymore after `<sycl/detail/core.hpp>` is included · Issue #19114 · intel/llvm · GitHub
[go: up one dir, main page]
More Web Proxy on the site http://driver.im/
Skip to content
NAN is not constexpr anymore after <sycl/detail/core.hpp> is included #19114
Open
@AlexeySachkov

Description

@AlexeySachkov

Describe the bug

Discovered in #19015 which dropped #include <sycl/atomic.hpp> from accessor.hpp, thus influencing the number and order of other headers included into accessor.hpp and core.hpp.

Somehow, on Windows that changed how NAN macro is defined making it non-constexpr anymore. The issue is dependent on MSVC version and/or versions of other Microsoft-provided components (like their Windows SDK or something) - I haven't been able to reproduce it on a Windows machine that's available to me.

# RUN: at line 7
D:/github/_work/llvm/llvm/install/bin/clang++.exe  -Werror -fsycl -fsycl-targets=spir64  D:\github\_work\llvm\llvm\llvm\sycl\test-e2e\DeviceLib\exp\exp-std-complex-float-edge-cases.cpp -o D:\github\_work\llvm\llvm\build-e2e\DeviceLib\exp\Output\exp-std-complex-float-edge-cases.cpp.tmp.out
# executed command: D:/github/_work/llvm/llvm/install/bin/clang++.exe -Werror -fsycl -fsycl-targets=spir64 'D:\github\_work\llvm\llvm\llvm\sycl\test-e2e\DeviceLib\exp\exp-std-complex-float-edge-cases.cpp' -o 'D:\github\_work\llvm\llvm\build-e2e\DeviceLib\exp\Output\exp-std-complex-float-edge-cases.cpp.tmp.out'
# .---command stderr------------
# | In file included from D:\github\_work\llvm\llvm\llvm\sycl\test-e2e\DeviceLib\exp\exp-std-complex-float-edge-cases.cpp:10:
# | D:\github\_work\llvm\llvm\llvm\sycl\test-e2e\DeviceLib\exp\exp-std-complex-edge-cases.hpp:24:29: error: constexpr variable 'testcases' must be initialized by a constant expression
# |    24 |   constexpr std::complex<T> testcases[] = {
# |       |                             ^             ~
# |    25 |       /* 0 */ std::complex<T>(1.e-6, 1.e-6),
# |       |       ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
# |    26 |       /* 1 */ std::complex<T>(-1.e-6, 1.e-6),
# |       |       ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
# |    27 |       /* 2 */ std::complex<T>(-1.e-6, -1.e-6),
# |       |       ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
# |    28 |       /* 3 */ std::complex<T>(1.e-6, -1.e-6),
# |       |       ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
# |    29 | 
# |    30 |       /* 4 */ std::complex<T>(1.e+6, 1.e-6),
# |       |       ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
# |    31 |       /* 5 */ std::complex<T>(-1.e+6, 1.e-6),
# |       |       ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
# |    32 |       /* 6 */ std::complex<T>(-1.e+6, -1.e-6),
# |       |       ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
# |    33 |       /* 7 */ std::complex<T>(1.e+6, -1.e-6),
# |       |       ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
# |    34 | 
# |    35 |       /* 8 */ std::complex<T>(1.e-6, 1.e+6),
# |       |       ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
# |    36 |       /* 9 */ std::complex<T>(-1.e-6, 1.e+6),
# |       |       ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
# |    37 |       /* 10 */ std::complex<T>(-1.e-6, -1.e+6),
# |       |       ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
# |    38 |       /* 11 */ std::complex<T>(1.e-6, -1.e+6),
# |       |       ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
# |    39 | 
# | D:\github\_work\llvm\llvm\llvm\sycl\test-e2e\DeviceLib\exp\exp-std-complex-float-edge-cases.cpp:12:21: note: in instantiation of function template specialization 'test<float>' requested here
# |    12 | int main() { return test<float>(); }
# |       |                     ^
# | D:\github\_work\llvm\llvm\llvm\sycl\test-e2e\DeviceLib\exp\exp-std-complex-edge-cases.hpp:63:32: note: floating point arithmetic produces a NaN
# |    63 |       /* 32 */ std::complex<T>(NAN, NAN),
# |       |                                ^
# | C:\Program Files (x86)\Windows Kits\10\include\10.0.22[621](https://github.com/intel/llvm/actions/runs/15729393865/job/44326718876#step:27:636).0\ucrt\corecrt_math.h:94:39: note: expanded from macro 'NAN'
# |    94 | #define NAN        (-(float)(INFINITY * 0.0F))
# |       |                                       ^
# | 1 error generated.
# `-----------------------------
# error: command failed with exit status: 1

To reproduce

See the log snippet above, it contains all commands.

Environment

  • OS: Windows
  • DPC++ version: latest intel/llvm

Additional context

No response

Metadata

Metadata

Assignees

No one assigned

    Labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions

      0