Skip to content

test-e2e\Basic\std_array.cpp fails to compile in debug mode on Windows #20515

@robertszafa

Description

@robertszafa

Describe the bug

The compilation of the Basic\std_array.cpp SYCL E2E test fails because device code cannot find a function used in the debug version of MSVC's C++ library:

> clang++ -DWIN32 -D_WINDOWS -Werror --driver-mode=cl -fsycl test-e2e\Basic\std_array.cpp /Od /MDd /Zi /EHsc
C:\Program Files\Microsoft Visual Studio\2022\Professional\VC\Tools\MSVC\14.44.35207
\include\array(531,9): error: SYCL kernel cannot call an undefined function without 
SYCL_EXTERNAL attribute
  531 |         _STL_VERIFY(_Pos < _Size, "array subscript out of range");
      |         ^
C:\Program Files\Microsoft Visual Studio\2022\Professional\VC\Tools\MSVC\14.44.35207
      |         ^
C:\Program Files\Microsoft Visual Studio\2022\Professional\VC\Tools\MSVC\14.44.35207\include\yva
ls.h(255,5): note: expanded from macro '_STL_REPORT_ERROR'
  255 |     _MSVC_STL_DOOM_FUNCTION(mesg)
      |     ^
C:\Program Files\Microsoft Visual Studio\2022\Professional\VC\Tools\MSVC\14.44.35207\include\yva
ls.h(249,41): note: expanded from macro '_MSVC_STL_DOOM_FUNCTION'
  249 | #define _MSVC_STL_DOOM_FUNCTION(mesg) ::_invoke_watson(nullptr, nullptr, nullptr, 0, 0) 
      |                                         ^
C:\Program Files (x86)\Windows Kits\10\include\10.0.22621.0\ucrt\corecrt.h(375,23): note: '_invo
ke_watson' declared here
  375 | _ACRTIMP void __cdecl _invoke_watson(
      |                       ^
C:\Program Files\Microsoft Visual Studio\2022\Professional\VC\Tools\MSVC\14.44.35207\include\arr
ay(529,39): note: called by 'operator[]'
  529 |     _NODISCARD _CONSTEXPR17 reference operator[](_In_range_(<, _Size) size_type _Pos) no
except /* strengthened */ {
      |                                       ^
1 error generated.

This is a known issue mentioned in the DPC++ release notes. Is someone working on fixing this already? If not, which option would be preferable for a fix?
a) Just fix the std_array E2E test by adding -D_ITERATOR_DEBUG_LEVEL=0 to its compilation command.
b) Add -D_ITERATOR_DEBUG_LEVEL=0 to the SYCL clang driver whenever a debug C++ library is used on Windows.

To reproduce

No response

Environment

No response

Additional context

No response

Metadata

Metadata

Assignees

No one assigned

    Labels

    bugSomething isn't working

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions