<table border="1" cellspacing="0" cellpadding="8">
<tr>
<th>Issue</th>
<td>
<a href=https://github.com/llvm/llvm-project/issues/108080>108080</a>
</td>
</tr>
<tr>
<th>Summary</th>
<td>
clang-tidy crashes with exception code: 0xC0000005
</td>
</tr>
<tr>
<th>Labels</th>
<td>
clang-tidy
</td>
</tr>
<tr>
<th>Assignees</th>
<td>
</td>
</tr>
<tr>
<th>Reporter</th>
<td>
dgswilkins
</td>
</tr>
</table>
<pre>
I was trying to check the following code:
[BugRepro.zip](https://github.com/user-attachments/files/16950199/BugRepro.zip)
with clang-tidy version from [LLVM 18.1.8-win64.exe](https://github.com/llvm/llvm-project/releases/download/llvmorg-18.1.8/LLVM-18.1.8-win64.exe) and it crashed with the following trace:
```
Stack dump:
0. Program arguments: "C:\\Program Files\\LLVM\\bin\\clang-tidy.exe" .\\BugRepro\\BugRepro.cpp -header-filter=.* -quiet -- -std=c++20 -Wall -Weverything -Wno-c++98-compat -Wno-unknown-pragmas -DUNICODE -D_UNICODE -D_MT -D_DLL -D_DEBUG -D_CONSOLE -D_DEBUG_FUNCTIONAL_MACHINERY -x c++
1. <eof> parser at end of file
2. While analyzing stack:
#0 Calling pcs_header::read_header(std::array<COLORREF, color_count> &) at line 33
#1 Calling main()
3. D:\BugRepro\.\BugRepro\BugRepro.cpp:20:39: Error evaluating statement
4. D:\BugRepro\.\BugRepro\BugRepro.cpp:20:39: Error evaluating statement
Exception Code: 0xC0000005
#0 0x00007ff79f720b2e (C:\Program Files\LLVM\bin\clang-tidy.exe+0x17d0b2e)
#1 0x00007ff79f37cbe9 (C:\Program Files\LLVM\bin\clang-tidy.exe+0x142cbe9)
#2 0x00007ff79f3e9b46 (C:\Program Files\LLVM\bin\clang-tidy.exe+0x1499b46)
#3 0x00007ff79f3e99e5 (C:\Program Files\LLVM\bin\clang-tidy.exe+0x14999e5)
#4 0x00007ff79f770856 (C:\Program Files\LLVM\bin\clang-tidy.exe+0x1820856)
#5 0x00007ff79f76f300 (C:\Program Files\LLVM\bin\clang-tidy.exe+0x181f300)
#6 0x00007ff79f771897 (C:\Program Files\LLVM\bin\clang-tidy.exe+0x1821897)
#7 0x00007ff79f3c8c75 (C:\Program Files\LLVM\bin\clang-tidy.exe+0x1478c75)
#8 0x00007ff79f76f7d2 (C:\Program Files\LLVM\bin\clang-tidy.exe+0x181f7d2)
#9 0x00007ff79f76f5b9 (C:\Program Files\LLVM\bin\clang-tidy.exe+0x181f5b9)
#10 0x00007ff79f3d62d1 (C:\Program Files\LLVM\bin\clang-tidy.exe+0x14862d1)
#11 0x00007ff79f3d3981 (C:\Program Files\LLVM\bin\clang-tidy.exe+0x1483981)
#12 0x00007ff79f3d37cb (C:\Program Files\LLVM\bin\clang-tidy.exe+0x14837cb)
#13 0x00007ff79f3e70c0 (C:\Program Files\LLVM\bin\clang-tidy.exe+0x14970c0)
#14 0x00007ff79f3e634c (C:\Program Files\LLVM\bin\clang-tidy.exe+0x149634c)
#15 0x00007ff79f1b1b61 (C:\Program Files\LLVM\bin\clang-tidy.exe+0x1261b61)
#16 0x00007ff79f1a60ba (C:\Program Files\LLVM\bin\clang-tidy.exe+0x12560ba)
#17 0x00007ff79f1b9263 (C:\Program Files\LLVM\bin\clang-tidy.exe+0x1269263)
#18 0x00007ff79ec5b208 (C:\Program Files\LLVM\bin\clang-tidy.exe+0xd0b208)
#19 0x00007ff79df6d981 (C:\Program Files\LLVM\bin\clang-tidy.exe+0x1d981)
#20 0x00007ff79df6d3f2 (C:\Program Files\LLVM\bin\clang-tidy.exe+0x1d3f2)
#21 0x00007ff79e451ae7 (C:\Program Files\LLVM\bin\clang-tidy.exe+0x501ae7)
#22 0x00007ff79e2ce245 (C:\Program Files\LLVM\bin\clang-tidy.exe+0x37e245)
#23 0x00007ff79e451985 (C:\Program Files\LLVM\bin\clang-tidy.exe+0x501985)
#24 0x00007ff79e4507cb (C:\Program Files\LLVM\bin\clang-tidy.exe+0x5007cb)
#25 0x00007ff79e45307c (C:\Program Files\LLVM\bin\clang-tidy.exe+0x50307c)
#26 0x00007ff79e2ca0a9 (C:\Program Files\LLVM\bin\clang-tidy.exe+0x37a0a9)
#27 0x00007ff79e294b01 (C:\Program Files\LLVM\bin\clang-tidy.exe+0x344b01)
#28 0x00007ff79f0e94b0 (C:\Program Files\LLVM\bin\clang-tidy.exe+0x11994b0)
#29 0x00007fffa1d1257d (C:\Windows\System32\KERNEL32.DLL+0x1257d)
#30 0x00007fffa24caf28 (C:\Windows\SYSTEM32\ntdll.dll+0x5af28)
```
Running this with clang tidy from LLVM 17.0.1 does not crash and generates the expected code quality warning:
```
& 'C:\Program Files\LLVM\bin\clang-tidy.exe' .\BugRepro\BugRepro.cpp -header-filter=".*" -quiet -- -std=c++20 -Wall -Weverything -Wno-c++98-compat -Wno-unknown-pragmas "-DUNICODE" "-D_UNICODE" "-D_MT" "-D_DLL" "-D_DEBUG" "-D_CONSOLE" "-D_DEBUG_FUNCTIONAL_MACHINERY" -x c++
2 warnings generated.
D:\BugRepro\BugRepro\BugRepro.cpp:6:10: warning: non-portable path to file '<Windows.h>'; specified path differs in case from file name on disk [clang-diagnostic-nonportable-system-include-path]
6 | #include <windows.h>
| ^~~~~~~~~~~
| <Windows.h>
```
</pre>
<img width="1px" height="1px" alt="" src="http://email.email.llvm.org/o/eJy0mF1z66oVhn8NvmGkQSD0ceELf7Z76iSd7OxmzlUGAbLVYPBBOE7ORX97B8mxjbLbTo9mazK2hMn7wFq82AvWts1WSzkFdA7ocsKObmfsVGzbU6NeG91OKiM-pt_gibXQ2Y9Gb6EzkO8kf4VuJ2FtlDIn38yNkIDMAFoCNAN0Pj9uH-XBmviP5gDoEuBi59yh9V3wGuD1tnG7YxVzswd4fWyljZhzjO_2UrsW4HXdKOnfk6ykKClLgNeBJC571KlxO8gV09vINeIDvknbNkZDWFuzh4DON5t_3MGkiJO4iE6NztJYvsv_OSKl3j7fooM1_5TcAby2UknWduMS5qSVYeLcydht1EMAXntk9AWJS8i0gI2D3LJ2JwXsxh6G0VnGb-LYv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