llvm / llvm-project

The LLVM Project is a collection of modular and reusable compiler and toolchain technologies.
http://llvm.org
Other
27.85k stars 11.47k forks source link

Clang-Tidy.exe access violation #63711

Open simonvnice opened 1 year ago

simonvnice commented 1 year ago

Since upgrading to Visual Studio Enterprise 17.6.4, clang-tidy.exe has started to crash with access violation. Note the STL installed with 17.6.4 requires v15 or greater so an older (working version) cannot be used.

Example of crash:

... -p=C:\\src\\_git176094_CC\\CCTV\\\\build-tmp\\Win32\\...
Exception Code: 0xC0000005
#0 0x015a9710 C:\Program Files\Microsoft Visual Studio\2022\Enterprise\VC\Tools\Llvm\bin\clang-tidy.exe 0x7c9710
0x015A9710, C:\Program Files\Microsoft Visual Studio\2022\Enterprise\VC\Tools\Llvm\bin\clang-tidy.exe(0x0000000000DE0000) + 0x7C9710 byte(s)
C:\Program Files\Microsoft Visual Studio\2022\Enterprise\MSBuild\Microsoft\VC\v170\Microsoft.Cpp.ClangTidy.targets(228,5): error MSB6006: "clang-tidy.exe" exited with code -1073741819.
63>Done building project "....vcxproj" -- FAILED.

Example of requirement for v15 or greater:

C:\Program Files\Microsoft Visual Studio\2022\Enterprise\VC\Tools\MSVC\14.36.32532\include\yvals_core.h(829,1): error G04961F0B: static_assert failed "Error in C++ Standard Library usage." [clang-diagnostic-error]
_EMIT_STL_ERROR(STL1000, "Unexpected compiler version, expected Clang 15.0.0 or newer.");
EugeneZelenko commented 1 year ago

Which version of Clang-tidy do you use?

simonvnice commented 1 year ago

Hi Eugene, Clang-tidy.exe is v15.0.1 (as supplied with Visual Studio 2022 17.6.4)

clang-tidy.exe --version LLVM (http://llvm.org/): LLVM version 15.0.1 Optimized build. Default target: x86_64-pc-windows-msvc Host CPU: tigerlake

llvmbot commented 1 year ago

@llvm/issue-subscribers-clang-tidy

simonvnice commented 1 year ago

The issue is generated when check modernize is used. That is, when .clang-tidy contains Checks:
' modernize-* '

PiotrZSL commented 1 year ago

Can you try all checks from modernize module to narrow issue to one ?

GitProJoe commented 10 months ago

Hi, I encountered the same crash, I could narrow it down to the check modernize-return-braced-init-list

bgedzior-logi commented 6 months ago

I'm encountering a similar problem with clang-tidy provided by the newest Microsoft's compiler (17.9.2)

& 'C:\Program Files\Microsoft Visual Studio\2022\Community\VC\Tools\Llvm\bin\clang-tidy.exe' --version       
LLVM (http://llvm.org/):
  LLVM version 17.0.3
  Optimized build.

For me the problematic setting is modernize-use-nullptr, whereas modernize-return-braced-init-list doesn't cause problems.

GarethRWhite commented 1 month ago

I have the same problem as @bgedzior-logi : Exception when checking with hicpp-use-nullptr or modernize-use-nullptr. All other checks work correctly.

clangd --version clangd version 17.0.3 Features: windows Platform: i686-pc-windows-msvc

clang-tidy --version LLVM (http://llvm.org/): LLVM version 17.0.3 Optimized build.

clang --version clang version 17.0.3 Target: i686-pc-windows-msvc Thread model: posix InstalledDir: C:\Program Files\Microsoft Visual Studio\2022\Professional\VC\Tools\Llvm\bin