Skip to content

[clang] Failure to compile cuda test file on windows #119661

Open
@0O0OwO0O0

Description

@0O0OwO0O0

[clang] Failure to compile cuda test file on windows
clang version:19.1.5

clang++ test.cu -o test.exe --target=x86_64-windows-msvc --cuda-path=C:/ProgramData/scoop/apps/cuda11.8/current  --cuda-gpu-arch=sm_89
In file included from <built-in>:1:
In file included from D:\llvm\lib\clang\19\include\__clang_cuda_runtime_wrapper.h:472:
In file included from D:\llvm\lib\clang\19\include\__clang_cuda_cmath.h:16:
In file included from C:\Program Files\Microsoft Visual Studio\2022\Community\VC\Tools\MSVC\14.42.34433\include\limits:12:
In file included from C:\Program Files\Microsoft Visual Studio\2022\Community\VC\Tools\MSVC\14.42.34433\include\cwchar:11:
In file included from C:\Program Files\Microsoft Visual Studio\2022\Community\VC\Tools\MSVC\14.42.34433\include\cstdio:11:
In file included from C:\Program Files (x86)\Windows Kits\10\include\10.0.26100.0\ucrt\stdio.h:13:
C:\Program Files (x86)\Windows Kits\10\include\10.0.26100.0\ucrt\corecrt_wstdio.h:486:24: error: non-const lvalue reference to type
      '__builtin_va_list' cannot bind to a value of unrelated type 'va_list' (aka 'char *')
  486 |         __crt_va_start(_ArgList, _Locale);
      |                        ^~~~~~~~
D:\llvm\lib\clang\19\include\vadefs.h:39:54: note: expanded from macro '__crt_va_start'
   39 | #define __crt_va_start(ap, param) __builtin_va_start(ap, param)
      |                                                      ^~
In file included from <built-in>:1:
In file included from D:\llvm\lib\clang\19\include\__clang_cuda_runtime_wrapper.h:472:
In file included from D:\llvm\lib\clang\19\include\__clang_cuda_cmath.h:16:
In file included from C:\Program Files\Microsoft Visual Studio\2022\Community\VC\Tools\MSVC\14.42.34433\include\limits:12:
In file included from C:\Program Files\Microsoft Visual Studio\2022\Community\VC\Tools\MSVC\14.42.34433\include\cwchar:11:
In file included from C:\Program Files\Microsoft Visual Studio\2022\Community\VC\Tools\MSVC\14.42.34433\include\cstdio:11:
In file included from C:\Program Files (x86)\Windows Kits\10\include\10.0.26100.0\ucrt\stdio.h:13:
C:\Program Files (x86)\Windows Kits\10\include\10.0.26100.0\ucrt\corecrt_wstdio.h:488:22: error: non-const lvalue reference to type
      '__builtin_va_list' cannot bind to a value of unrelated type 'va_list' (aka 'char *')
  488 |         __crt_va_end(_ArgList);
      |                      ^~~~~~~~
D:\llvm\lib\clang\19\include\vadefs.h:43:52: note: expanded from macro '__crt_va_end'
   43 | #define __crt_va_end(ap)          __builtin_va_end(ap)
      |                                                    ^~
In file included from <built-in>:1:
In file included from D:\llvm\lib\clang\19\include\__clang_cuda_runtime_wrapper.h:472:
In file included from D:\llvm\lib\clang\19\include\__clang_cuda_cmath.h:16:
In file included from C:\Program Files\Microsoft Visual Studio\2022\Community\VC\Tools\MSVC\14.42.34433\include\limits:12:
In file included from C:\Program Files\Microsoft Visual Studio\2022\Community\VC\Tools\MSVC\14.42.34433\include\cwchar:11:
In file included from C:\Program Files\Microsoft Visual Studio\2022\Community\VC\Tools\MSVC\14.42.34433\include\cstdio:11:
In file included from C:\Program Files (x86)\Windows Kits\10\include\10.0.26100.0\ucrt\stdio.h:13:
C:\Program Files (x86)\Windows Kits\10\include\10.0.26100.0\ucrt\corecrt_wstdio.h:504:24: error: non-const lvalue reference to type
      '__builtin_va_list' cannot bind to a value of unrelated type 'va_list' (aka 'char *')
  504 |         __crt_va_start(_ArgList, _Format);
      |                        ^~~~~~~~
D:\llvm\lib\clang\19\include\vadefs.h:39:54: note: expanded from macro '__crt_va_start'
   39 | #define __crt_va_start(ap, param) __builtin_va_start(ap, param)
      |                                                      ^~
In file included from <built-in>:1:
In file included from D:\llvm\lib\clang\19\include\__clang_cuda_runtime_wrapper.h:472:
In file included from D:\llvm\lib\clang\19\include\__clang_cuda_cmath.h:16:
In file included from C:\Program Files\Microsoft Visual Studio\2022\Community\VC\Tools\MSVC\14.42.34433\include\limits:12:
In file included from C:\Program Files\Microsoft Visual Studio\2022\Community\VC\Tools\MSVC\14.42.34433\include\cwchar:11:
In file included from C:\Program Files\Microsoft Visual Studio\2022\Community\VC\Tools\MSVC\14.42.34433\include\cstdio:11:
In file included from C:\Program Files (x86)\Windows Kits\10\include\10.0.26100.0\ucrt\stdio.h:13:
C:\Program Files (x86)\Windows Kits\10\include\10.0.26100.0\ucrt\corecrt_wstdio.h:506:22: error: non-const lvalue reference to type
      '__builtin_va_list' cannot bind to a value of unrelated type 'va_list' (aka 'char *')
  506 |         __crt_va_end(_ArgList);
      |                      ^~~~~~~~
D:\llvm\lib\clang\19\include\vadefs.h:43:52: note: expanded from macro '__crt_va_end'
   43 | #define __crt_va_end(ap)          __builtin_va_end(ap)
      |                                                    ^~
In file included from <built-in>:1:
In file included from D:\llvm\lib\clang\19\include\__clang_cuda_runtime_wrapper.h:472:
In file included from D:\llvm\lib\clang\19\include\__clang_cuda_cmath.h:16:
In file included from C:\Program Files\Microsoft Visual Studio\2022\Community\VC\Tools\MSVC\14.42.34433\include\limits:12:
In file included from C:\Program Files\Microsoft Visual Studio\2022\Community\VC\Tools\MSVC\14.42.34433\include\cwchar:11:
In file included from C:\Program Files\Microsoft Visual Studio\2022\Community\VC\Tools\MSVC\14.42.34433\include\cstdio:11:
In file included from C:\Program Files (x86)\Windows Kits\10\include\10.0.26100.0\ucrt\stdio.h:13:
C:\Program Files (x86)\Windows Kits\10\include\10.0.26100.0\ucrt\corecrt_wstdio.h:523:24: error: non-const lvalue reference to type
      '__builtin_va_list' cannot bind to a value of unrelated type 'va_list' (aka 'char *')
  523 |         __crt_va_start(_ArgList, _Locale);
      |                        ^~~~~~~~
D:\llvm\lib\clang\19\include\vadefs.h:39:54: note: expanded from macro '__crt_va_start'
   39 | #define __crt_va_start(ap, param) __builtin_va_start(ap, param)
      |                                                      ^~
In file included from <built-in>:1:
In file included from D:\llvm\lib\clang\19\include\__clang_cuda_runtime_wrapper.h:472:
In file included from D:\llvm\lib\clang\19\include\__clang_cuda_cmath.h:16:
In file included from C:\Program Files\Microsoft Visual Studio\2022\Community\VC\Tools\MSVC\14.42.34433\include\limits:12:
In file included from C:\Program Files\Microsoft Visual Studio\2022\Community\VC\Tools\MSVC\14.42.34433\include\cwchar:11:
In file included from C:\Program Files\Microsoft Visual Studio\2022\Community\VC\Tools\MSVC\14.42.34433\include\cstdio:11:
In file included from C:\Program Files (x86)\Windows Kits\10\include\10.0.26100.0\ucrt\stdio.h:13:
C:\Program Files (x86)\Windows Kits\10\include\10.0.26100.0\ucrt\corecrt_wstdio.h:525:22: error: non-const lvalue reference to type
      '__builtin_va_list' cannot bind to a value of unrelated type 'va_list' (aka 'char *')
  525 |         __crt_va_end(_ArgList);
      |                      ^~~~~~~~
D:\llvm\lib\clang\19\include\vadefs.h:43:52: note: expanded from macro '__crt_va_end'
   43 | #define __crt_va_end(ap)          __builtin_va_end(ap)
      |                                                    ^~
In file included from <built-in>:1:
In file included from D:\llvm\lib\clang\19\include\__clang_cuda_runtime_wrapper.h:472:
In file included from D:\llvm\lib\clang\19\include\__clang_cuda_cmath.h:16:
In file included from C:\Program Files\Microsoft Visual Studio\2022\Community\VC\Tools\MSVC\14.42.34433\include\limits:12:
In file included from C:\Program Files\Microsoft Visual Studio\2022\Community\VC\Tools\MSVC\14.42.34433\include\cwchar:11:
In file included from C:\Program Files\Microsoft Visual Studio\2022\Community\VC\Tools\MSVC\14.42.34433\include\cstdio:11:
In file included from C:\Program Files (x86)\Windows Kits\10\include\10.0.26100.0\ucrt\stdio.h:13:
C:\Program Files (x86)\Windows Kits\10\include\10.0.26100.0\ucrt\corecrt_wstdio.h:543:28: error: non-const lvalue reference to type
      '__builtin_va_list' cannot bind to a value of unrelated type 'va_list' (aka 'char *')
  543 |             __crt_va_start(_ArgList, _Format);
      |                            ^~~~~~~~
D:\llvm\lib\clang\19\include\vadefs.h:39:54: note: expanded from macro '__crt_va_start'
   39 | #define __crt_va_start(ap, param) __builtin_va_start(ap, param)
      |                                                      ^~
In file included from <built-in>:1:
In file included from D:\llvm\lib\clang\19\include\__clang_cuda_runtime_wrapper.h:472:
In file included from D:\llvm\lib\clang\19\include\__clang_cuda_cmath.h:16:
In file included from C:\Program Files\Microsoft Visual Studio\2022\Community\VC\Tools\MSVC\14.42.34433\include\limits:12:
In file included from C:\Program Files\Microsoft Visual Studio\2022\Community\VC\Tools\MSVC\14.42.34433\include\cwchar:11:
In file included from C:\Program Files\Microsoft Visual Studio\2022\Community\VC\Tools\MSVC\14.42.34433\include\cstdio:11:
In file included from C:\Program Files (x86)\Windows Kits\10\include\10.0.26100.0\ucrt\stdio.h:13:
C:\Program Files (x86)\Windows Kits\10\include\10.0.26100.0\ucrt\corecrt_wstdio.h:545:26: error: non-const lvalue reference to type
      '__builtin_va_list' cannot bind to a value of unrelated type 'va_list' (aka 'char *')
  545 |             __crt_va_end(_ArgList);
      |                          ^~~~~~~~
D:\llvm\lib\clang\19\include\vadefs.h:43:52: note: expanded from macro '__crt_va_end'
   43 | #define __crt_va_end(ap)          __builtin_va_end(ap)
      |                                                    ^~
In file included from <built-in>:1:
In file included from D:\llvm\lib\clang\19\include\__clang_cuda_runtime_wrapper.h:472:
In file included from D:\llvm\lib\clang\19\include\__clang_cuda_cmath.h:16:
In file included from C:\Program Files\Microsoft Visual Studio\2022\Community\VC\Tools\MSVC\14.42.34433\include\limits:12:
In file included from C:\Program Files\Microsoft Visual Studio\2022\Community\VC\Tools\MSVC\14.42.34433\include\cwchar:11:
In file included from C:\Program Files\Microsoft Visual Studio\2022\Community\VC\Tools\MSVC\14.42.34433\include\cstdio:11:
In file included from C:\Program Files (x86)\Windows Kits\10\include\10.0.26100.0\ucrt\stdio.h:13:
C:\Program Files (x86)\Windows Kits\10\include\10.0.26100.0\ucrt\corecrt_wstdio.h:564:24: error: non-const lvalue reference to type
      '__builtin_va_list' cannot bind to a value of unrelated type 'va_list' (aka 'char *')
  564 |         __crt_va_start(_ArgList, _Locale);
      |                        ^~~~~~~~
D:\llvm\lib\clang\19\include\vadefs.h:39:54: note: expanded from macro '__crt_va_start'
   39 | #define __crt_va_start(ap, param) __builtin_va_start(ap, param)
      |                                                      ^~
In file included from <built-in>:1:
In file included from D:\llvm\lib\clang\19\include\__clang_cuda_runtime_wrapper.h:472:
In file included from D:\llvm\lib\clang\19\include\__clang_cuda_cmath.h:16:
In file included from C:\Program Files\Microsoft Visual Studio\2022\Community\VC\Tools\MSVC\14.42.34433\include\limits:12:
In file included from C:\Program Files\Microsoft Visual Studio\2022\Community\VC\Tools\MSVC\14.42.34433\include\cwchar:11:
In file included from C:\Program Files\Microsoft Visual Studio\2022\Community\VC\Tools\MSVC\14.42.34433\include\cstdio:11:
In file included from C:\Program Files (x86)\Windows Kits\10\include\10.0.26100.0\ucrt\stdio.h:13:
C:\Program Files (x86)\Windows Kits\10\include\10.0.26100.0\ucrt\corecrt_wstdio.h:566:22: error: non-const lvalue reference to type
      '__builtin_va_list' cannot bind to a value of unrelated type 'va_list' (aka 'char *')
  566 |         __crt_va_end(_ArgList);
      |                      ^~~~~~~~
D:\llvm\lib\clang\19\include\vadefs.h:43:52: note: expanded from macro '__crt_va_end'
   43 | #define __crt_va_end(ap)          __builtin_va_end(ap)
      |                                                    ^~
In file included from <built-in>:1:
In file included from D:\llvm\lib\clang\19\include\__clang_cuda_runtime_wrapper.h:472:
In file included from D:\llvm\lib\clang\19\include\__clang_cuda_cmath.h:16:
In file included from C:\Program Files\Microsoft Visual Studio\2022\Community\VC\Tools\MSVC\14.42.34433\include\limits:12:
In file included from C:\Program Files\Microsoft Visual Studio\2022\Community\VC\Tools\MSVC\14.42.34433\include\cwchar:11:
In file included from C:\Program Files\Microsoft Visual Studio\2022\Community\VC\Tools\MSVC\14.42.34433\include\cstdio:11:
In file included from C:\Program Files (x86)\Windows Kits\10\include\10.0.26100.0\ucrt\stdio.h:13:
C:\Program Files (x86)\Windows Kits\10\include\10.0.26100.0\ucrt\corecrt_wstdio.h:582:24: error: non-const lvalue reference to type
      '__builtin_va_list' cannot bind to a value of unrelated type 'va_list' (aka 'char *')
  582 |         __crt_va_start(_ArgList, _Format);
      |                        ^~~~~~~~
D:\llvm\lib\clang\19\include\vadefs.h:39:54: note: expanded from macro '__crt_va_start'
   39 | #define __crt_va_start(ap, param) __builtin_va_start(ap, param)
      |                                                      ^~
In file included from <built-in>:1:
In file included from D:\llvm\lib\clang\19\include\__clang_cuda_runtime_wrapper.h:472:
In file included from D:\llvm\lib\clang\19\include\__clang_cuda_cmath.h:16:
In file included from C:\Program Files\Microsoft Visual Studio\2022\Community\VC\Tools\MSVC\14.42.34433\include\limits:12:
In file included from C:\Program Files\Microsoft Visual Studio\2022\Community\VC\Tools\MSVC\14.42.34433\include\cwchar:11:
In file included from C:\Program Files\Microsoft Visual Studio\2022\Community\VC\Tools\MSVC\14.42.34433\include\cstdio:11:
In file included from C:\Program Files (x86)\Windows Kits\10\include\10.0.26100.0\ucrt\stdio.h:13:
C:\Program Files (x86)\Windows Kits\10\include\10.0.26100.0\ucrt\corecrt_wstdio.h:584:22: error: non-const lvalue reference to type
      '__builtin_va_list' cannot bind to a value of unrelated type 'va_list' (aka 'char *')
  584 |         __crt_va_end(_ArgList);
      |                      ^~~~~~~~
D:\llvm\lib\clang\19\include\vadefs.h:43:52: note: expanded from macro '__crt_va_end'
   43 | #define __crt_va_end(ap)          __builtin_va_end(ap)
      |                                                    ^~
In file included from <built-in>:1:
In file included from D:\llvm\lib\clang\19\include\__clang_cuda_runtime_wrapper.h:472:
In file included from D:\llvm\lib\clang\19\include\__clang_cuda_cmath.h:16:
In file included from C:\Program Files\Microsoft Visual Studio\2022\Community\VC\Tools\MSVC\14.42.34433\include\limits:12:
In file included from C:\Program Files\Microsoft Visual Studio\2022\Community\VC\Tools\MSVC\14.42.34433\include\cwchar:11:
In file included from C:\Program Files\Microsoft Visual Studio\2022\Community\VC\Tools\MSVC\14.42.34433\include\cstdio:11:
In file included from C:\Program Files (x86)\Windows Kits\10\include\10.0.26100.0\ucrt\stdio.h:13:
C:\Program Files (x86)\Windows Kits\10\include\10.0.26100.0\ucrt\corecrt_wstdio.h:600:24: error: non-const lvalue reference to type
      '__builtin_va_list' cannot bind to a value of unrelated type 'va_list' (aka 'char *')
  600 |         __crt_va_start(_ArgList, _Locale);
      |                        ^~~~~~~~
D:\llvm\lib\clang\19\include\vadefs.h:39:54: note: expanded from macro '__crt_va_start'
   39 | #define __crt_va_start(ap, param) __builtin_va_start(ap, param)
      |                                                      ^~
In file included from <built-in>:1:
In file included from D:\llvm\lib\clang\19\include\__clang_cuda_runtime_wrapper.h:472:
In file included from D:\llvm\lib\clang\19\include\__clang_cuda_cmath.h:16:
In file included from C:\Program Files\Microsoft Visual Studio\2022\Community\VC\Tools\MSVC\14.42.34433\include\limits:12:
In file included from C:\Program Files\Microsoft Visual Studio\2022\Community\VC\Tools\MSVC\14.42.34433\include\cwchar:11:
In file included from C:\Program Files\Microsoft Visual Studio\2022\Community\VC\Tools\MSVC\14.42.34433\include\cstdio:11:
In file included from C:\Program Files (x86)\Windows Kits\10\include\10.0.26100.0\ucrt\stdio.h:13:
C:\Program Files (x86)\Windows Kits\10\include\10.0.26100.0\ucrt\corecrt_wstdio.h:602:22: error: non-const lvalue reference to type
      '__builtin_va_list' cannot bind to a value of unrelated type 'va_list' (aka 'char *')
  602 |         __crt_va_end(_ArgList);
      |                      ^~~~~~~~
D:\llvm\lib\clang\19\include\vadefs.h:43:52: note: expanded from macro '__crt_va_end'
   43 | #define __crt_va_end(ap)          __builtin_va_end(ap)
      |                                                    ^~
In file included from <built-in>:1:
In file included from D:\llvm\lib\clang\19\include\__clang_cuda_runtime_wrapper.h:472:
In file included from D:\llvm\lib\clang\19\include\__clang_cuda_cmath.h:16:
In file included from C:\Program Files\Microsoft Visual Studio\2022\Community\VC\Tools\MSVC\14.42.34433\include\limits:12:
In file included from C:\Program Files\Microsoft Visual Studio\2022\Community\VC\Tools\MSVC\14.42.34433\include\cwchar:11:
In file included from C:\Program Files\Microsoft Visual Studio\2022\Community\VC\Tools\MSVC\14.42.34433\include\cstdio:11:
In file included from C:\Program Files (x86)\Windows Kits\10\include\10.0.26100.0\ucrt\stdio.h:13:
C:\Program Files (x86)\Windows Kits\10\include\10.0.26100.0\ucrt\corecrt_wstdio.h:617:24: error: non-const lvalue reference to type
      '__builtin_va_list' cannot bind to a value of unrelated type 'va_list' (aka 'char *')
  617 |         __crt_va_start(_ArgList, _Format);
      |                        ^~~~~~~~
D:\llvm\lib\clang\19\include\vadefs.h:39:54: note: expanded from macro '__crt_va_start'
   39 | #define __crt_va_start(ap, param) __builtin_va_start(ap, param)
      |                                                      ^~
In file included from <built-in>:1:
In file included from D:\llvm\lib\clang\19\include\__clang_cuda_runtime_wrapper.h:472:
In file included from D:\llvm\lib\clang\19\include\__clang_cuda_cmath.h:16:
In file included from C:\Program Files\Microsoft Visual Studio\2022\Community\VC\Tools\MSVC\14.42.34433\include\limits:12:
In file included from C:\Program Files\Microsoft Visual Studio\2022\Community\VC\Tools\MSVC\14.42.34433\include\cwchar:11:
In file included from C:\Program Files\Microsoft Visual Studio\2022\Community\VC\Tools\MSVC\14.42.34433\include\cstdio:11:
In file included from C:\Program Files (x86)\Windows Kits\10\include\10.0.26100.0\ucrt\stdio.h:13:
C:\Program Files (x86)\Windows Kits\10\include\10.0.26100.0\ucrt\corecrt_wstdio.h:619:22: error: non-const lvalue reference to type
      '__builtin_va_list' cannot bind to a value of unrelated type 'va_list' (aka 'char *')
  619 |         __crt_va_end(_ArgList);
      |                      ^~~~~~~~
D:\llvm\lib\clang\19\include\vadefs.h:43:52: note: expanded from macro '__crt_va_end'
   43 | #define __crt_va_end(ap)          __builtin_va_end(ap)
      |                                                    ^~
In file included from <built-in>:1:
In file included from D:\llvm\lib\clang\19\include\__clang_cuda_runtime_wrapper.h:472:
In file included from D:\llvm\lib\clang\19\include\__clang_cuda_cmath.h:16:
In file included from C:\Program Files\Microsoft Visual Studio\2022\Community\VC\Tools\MSVC\14.42.34433\include\limits:12:
In file included from C:\Program Files\Microsoft Visual Studio\2022\Community\VC\Tools\MSVC\14.42.34433\include\cwchar:11:
In file included from C:\Program Files\Microsoft Visual Studio\2022\Community\VC\Tools\MSVC\14.42.34433\include\cstdio:11:
In file included from C:\Program Files (x86)\Windows Kits\10\include\10.0.26100.0\ucrt\stdio.h:13:
C:\Program Files (x86)\Windows Kits\10\include\10.0.26100.0\ucrt\corecrt_wstdio.h:635:24: error: non-const lvalue reference to type
      '__builtin_va_list' cannot bind to a value of unrelated type 'va_list' (aka 'char *')
  635 |         __crt_va_start(_ArgList, _Locale);
      |                        ^~~~~~~~
D:\llvm\lib\clang\19\include\vadefs.h:39:54: note: expanded from macro '__crt_va_start'
   39 | #define __crt_va_start(ap, param) __builtin_va_start(ap, param)
      |                                                      ^~
In file included from <built-in>:1:
In file included from D:\llvm\lib\clang\19\include\__clang_cuda_runtime_wrapper.h:472:
In file included from D:\llvm\lib\clang\19\include\__clang_cuda_cmath.h:16:
In file included from C:\Program Files\Microsoft Visual Studio\2022\Community\VC\Tools\MSVC\14.42.34433\include\limits:12:
In file included from C:\Program Files\Microsoft Visual Studio\2022\Community\VC\Tools\MSVC\14.42.34433\include\cwchar:11:
In file included from C:\Program Files\Microsoft Visual Studio\2022\Community\VC\Tools\MSVC\14.42.34433\include\cstdio:11:
In file included from C:\Program Files (x86)\Windows Kits\10\include\10.0.26100.0\ucrt\stdio.h:13:
C:\Program Files (x86)\Windows Kits\10\include\10.0.26100.0\ucrt\corecrt_wstdio.h:637:22: error: non-const lvalue reference to type
      '__builtin_va_list' cannot bind to a value of unrelated type 'va_list' (aka 'char *')
  637 |         __crt_va_end(_ArgList);
      |                      ^~~~~~~~
D:\llvm\lib\clang\19\include\vadefs.h:43:52: note: expanded from macro '__crt_va_end'
   43 | #define __crt_va_end(ap)          __builtin_va_end(ap)
      |                                                    ^~
In file included from <built-in>:1:
In file included from D:\llvm\lib\clang\19\include\__clang_cuda_runtime_wrapper.h:472:
In file included from D:\llvm\lib\clang\19\include\__clang_cuda_cmath.h:16:
In file included from C:\Program Files\Microsoft Visual Studio\2022\Community\VC\Tools\MSVC\14.42.34433\include\limits:12:
In file included from C:\Program Files\Microsoft Visual Studio\2022\Community\VC\Tools\MSVC\14.42.34433\include\cwchar:11:
In file included from C:\Program Files\Microsoft Visual Studio\2022\Community\VC\Tools\MSVC\14.42.34433\include\cstdio:11:
In file included from C:\Program Files (x86)\Windows Kits\10\include\10.0.26100.0\ucrt\stdio.h:13:
C:\Program Files (x86)\Windows Kits\10\include\10.0.26100.0\ucrt\corecrt_wstdio.h:654:28: error: non-const lvalue reference to type
      '__builtin_va_list' cannot bind to a value of unrelated type 'va_list' (aka 'char *')
  654 |             __crt_va_start(_ArgList, _Format);
      |                            ^~~~~~~~
D:\llvm\lib\clang\19\include\vadefs.h:39:54: note: expanded from macro '__crt_va_start'
   39 | #define __crt_va_start(ap, param) __builtin_va_start(ap, param)
      |                                                      ^~
fatal error: too many errors emitted, stopping now [-ferror-limit=]
20 errors generated when compiling for sm_89.
clang++ test.cu -o test.exe --target=x86_64-windows-gnu --cuda-path=C:/ProgramData/scoop/apps/cuda11.8/current  --cuda-gpu-arch=sm_89
In file included from <built-in>:1:
In file included from D:\llvm\lib\clang\19\include\__clang_cuda_runtime_wrapper.h:349:
C:/ProgramData/scoop/apps/cuda11.8/current/include\crt/math_functions.hpp:413:10: error: no matching function for call to '__signbitl'
  413 |   return __signbitl(a);
      |          ^~~~~~~~~~
C:/ProgramData/scoop/apps/cuda11.8/current/include\crt/math_functions.hpp:2663:14: note: candidate function not viable: call to __host__ function from __device__
      function
 2663 | __func__(int __signbitl(const long double a))
      |              ^
In file included from <built-in>:1:
In file included from D:\llvm\lib\clang\19\include\__clang_cuda_runtime_wrapper.h:349:
C:/ProgramData/scoop/apps/cuda11.8/current/include\crt/math_functions.hpp:418:10: error: no matching function for call to '__signbit'
  418 |   return __signbit(a);
      |          ^~~~~~~~~
C:/ProgramData/scoop/apps/cuda11.8/current/include\crt/math_functions.hpp:1280:14: note: candidate function not viable: call to __host__ function from __device__
      function
 1280 | __func__(int __signbit(double a))
      |              ^
In file included from <built-in>:1:
In file included from D:\llvm\lib\clang\19\include\__clang_cuda_runtime_wrapper.h:349:
C:/ProgramData/scoop/apps/cuda11.8/current/include\crt/math_functions.hpp:430:10: error: no matching function for call to '__isinfl'
  430 |   return __isinfl(a);
      |          ^~~~~~~~
C:/ProgramData/scoop/apps/cuda11.8/current/include\crt/math_functions.hpp:2683:14: note: candidate function not viable: call to __host__ function from __device__
      function
 2683 | __func__(int __isinfl(const long double a))
      |              ^
In file included from <built-in>:1:
In file included from D:\llvm\lib\clang\19\include\__clang_cuda_runtime_wrapper.h:349:
C:/ProgramData/scoop/apps/cuda11.8/current/include\crt/math_functions.hpp:444:62: error: functions that differ only in their return type cannot be overloaded
  444 | static __inline__ __host__ __device__ __cudart_builtin__ int isinf(const double a)
      |                                                          ~~~ ^
D:\llvm\lib\clang\19\include\__clang_cuda_math_forward_declares.h:99:17: note: previous declaration is here
   99 | __DEVICE__ bool isinf(double);
      |            ~~~~ ^
In file included from <built-in>:1:
In file included from D:\llvm\lib\clang\19\include\__clang_cuda_runtime_wrapper.h:349:
C:/ProgramData/scoop/apps/cuda11.8/current/include\crt/math_functions.hpp:460:62: error: functions that differ only in their return type cannot be overloaded
  460 | static __inline__ __host__ __device__ __cudart_builtin__ int isinf(const float a)
      |                                                          ~~~ ^
D:\llvm\lib\clang\19\include\__clang_cuda_math_forward_declares.h:100:17: note: previous declaration is here
  100 | __DEVICE__ bool isinf(float);
      |            ~~~~ ^
In file included from <built-in>:1:
In file included from D:\llvm\lib\clang\19\include\__clang_cuda_runtime_wrapper.h:349:
C:/ProgramData/scoop/apps/cuda11.8/current/include\crt/math_functions.hpp:478:10: error: no matching function for call to '__isnanl'
  478 |   return __isnanl(a);
      |          ^~~~~~~~
C:/ProgramData/scoop/apps/cuda11.8/current/include\crt/math_functions.hpp:2693:14: note: candidate function not viable: call to __host__ function from __device__
      function
 2693 | __func__(int __isnanl(const long double a))
      |              ^
In file included from <built-in>:1:
In file included from D:\llvm\lib\clang\19\include\__clang_cuda_runtime_wrapper.h:349:
C:/ProgramData/scoop/apps/cuda11.8/current/include\crt/math_functions.hpp:492:62: error: functions that differ only in their return type cannot be overloaded
  492 | static __inline__ __host__ __device__ __cudart_builtin__ int isnan(const double a)
      |                                                          ~~~ ^
D:\llvm\lib\clang\19\include\__clang_cuda_math_forward_declares.h:110:17: note: previous declaration is here
  110 | __DEVICE__ bool isnan(double);
      |            ~~~~ ^
In file included from <built-in>:1:
In file included from D:\llvm\lib\clang\19\include\__clang_cuda_runtime_wrapper.h:349:
C:/ProgramData/scoop/apps/cuda11.8/current/include\crt/math_functions.hpp:508:62: error: functions that differ only in their return type cannot be overloaded
  508 | static __inline__ __host__ __device__ __cudart_builtin__ int isnan(const float a)
      |                                                          ~~~ ^
D:\llvm\lib\clang\19\include\__clang_cuda_math_forward_declares.h:111:17: note: previous declaration is here
  111 | __DEVICE__ bool isnan(float);
      |            ~~~~ ^
In file included from <built-in>:1:
In file included from D:\llvm\lib\clang\19\include\__clang_cuda_runtime_wrapper.h:349:
C:/ProgramData/scoop/apps/cuda11.8/current/include\crt/math_functions.hpp:526:10: error: no matching function for call to '__finitel'
  526 |   return __finitel(a);
      |          ^~~~~~~~~
C:/ProgramData/scoop/apps/cuda11.8/current/include\crt/math_functions.hpp:2673:14: note: candidate function not viable: call to __host__ function from __device__
      function
 2673 | __func__(int __finitel(const long double a))
      |              ^
In file included from <built-in>:1:
In file included from D:\llvm\lib\clang\19\include\__clang_cuda_runtime_wrapper.h:349:
C:/ProgramData/scoop/apps/cuda11.8/current/include\crt/math_functions.hpp:540:62: error: functions that differ only in their return type cannot be overloaded
  540 | static __inline__ __host__ __device__ __cudart_builtin__ int isfinite(const double a)
      |                                                          ~~~ ^
D:\llvm\lib\clang\19\include\__clang_cuda_math_forward_declares.h:90:17: note: previous declaration is here
   90 | __DEVICE__ bool isfinite(double);
      |            ~~~~ ^
In file included from <built-in>:1:
In file included from D:\llvm\lib\clang\19\include\__clang_cuda_runtime_wrapper.h:349:
C:/ProgramData/scoop/apps/cuda11.8/current/include\crt/math_functions.hpp:556:62: error: functions that differ only in their return type cannot be overloaded
  556 | static __inline__ __host__ __device__ __cudart_builtin__ int isfinite(const float a)
      |                                                          ~~~ ^
D:\llvm\lib\clang\19\include\__clang_cuda_math_forward_declares.h:91:17: note: previous declaration is here
   91 | __DEVICE__ bool isfinite(float);
      |            ~~~~ ^
11 errors generated when compiling for sm_89.

test.cu(Successful compilation with nvcc)

#include <iostream>

__global__ void add(int *a, int *b, int *c) {
    int index = threadIdx.x;
    c[index] = a[index] + b[index];
}

int main() {
    const int arraySize = 5;
    int a[arraySize] = {1, 2, 3, 4, 5};
    int b[arraySize] = {10, 20, 30, 40, 50};
    int c[arraySize] = {0};

    int *d_a, *d_b, *d_c;
    cudaMalloc((void**)&d_a, arraySize * sizeof(int));
    cudaMalloc((void**)&d_b, arraySize * sizeof(int));
    cudaMalloc((void**)&d_c, arraySize * sizeof(int));

    cudaMemcpy(d_a, a, arraySize * sizeof(int), cudaMemcpyHostToDevice);
    cudaMemcpy(d_b, b, arraySize * sizeof(int), cudaMemcpyHostToDevice);

    add<<<1, arraySize>>>(d_a, d_b, d_c);

    cudaMemcpy(c, d_c, arraySize * sizeof(int), cudaMemcpyDeviceToHost);

    std::cout << "Result: ";
    for (int i = 0; i < arraySize; i++) {
        std::cout << c[i] << " ";
    }
    std::cout << std::endl;

    cudaFree(d_a);
    cudaFree(d_b);
    cudaFree(d_c);

    return 0;
}

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions