Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

bugprone-easily-swappable-parameters: Crash when parsing code with 13.0.0-rc1 #50783

Closed
llvmbot opened this issue Aug 11, 2021 · 19 comments
Closed
Assignees
Labels
bugzilla Issues migrated from bugzilla clang-tidy crash-on-invalid duplicate Resolved as duplicate

Comments

@llvmbot
Copy link
Collaborator

llvmbot commented Aug 11, 2021

Bugzilla Link 51441
Resolution DUPLICATE
Resolved on Oct 11, 2021 20:29
Version unspecified
OS Windows NT
Blocks #51489
Attachments Stack dump and comments
Reporter LLVM Bugzilla Contributor
CC @tstellar,@whisperity
Fixed by commit(s) 2183212 e097724

Extended Description

Running with Clang Power Tools 7.5.0 on VS 2019 Update 11.0 and LLVM 13.0.0-rc1 (Win64) with Win 10 x64, I get a crash in clang-tidy 13.0.0-rc1 (Win64 build):

Running with Clang Power Tools 7.5.0 on VS 2019 Update 11.0 and LLVM 13.0.0-rc1 (Win64) with Win 10 x64


Sample source code:
// ConsoleApplication1.cpp : This file contains the 'main' function. Program
// execution begins and ends there.
//

// lint +e*

#include
#include
auto main(int argc, char** argv) -> int
{
(void)argc;
(void)argv;

short s = 34;
long l = s;

std::vector<std::auto_ptr<int>> myset;    

return (l*l);

}


Invocation was:
VERBOSE: INVOKE: C:\Program Files\LLVM\bin"C:\Program Files\LLVM\bin\clang-tidy.exe"
"C:\Users\mike\source\repos\ConsoleApplication1\ConsoleApplication1.cpp" -header-filter=".*" -quiet --
-isystem"C:\Program Files (x86)\Microsoft Visual Studio\2019\Professional\VC\Tools\MSVC\14.29.30133\include"
-isystem"C:\Program Files (x86)\Microsoft Visual Studio\2019\Professional\VC\Tools\MSVC\14.29.30133\atlmfc\include"
-isystem"C:\Program Files (x86)\Microsoft Visual Studio\2019\Professional\VC\Auxiliary\VS\include" -isystem"C:\Program
Files (x86)\Windows Kits\10\Include\10.0.19041.0\ucrt" -isystem"C:\Program Files (x86)\Windows
Kits\10\Include\10.0.19041.0\um" -isystem"C:\Program Files (x86)\Windows Kits\10\Include\10.0.19041.0\shared"
-isystem"C:\Program Files (x86)\Windows Kits\10\Include\10.0.19041.0\winrt" -isystem"C:\Program Files (x86)\Windows
Kits\10\Include\10.0.19041.0\cppwinrt" -std=c++14 -Wall -fms-compatibility-version=19.10 -Wmicrosoft
-Wno-invalid-token-paste -Wno-unknown-pragmas -Wno-unused-value -m32 "-DUNICODE" "-D_UNICODE" "-D_MT" "-D_DLL"
"-DWIN32" "-DNDEBUG" "-D_CONSOLE" "-D_DEBUG_FUNCTIONAL_MACHINERY" -x c++

1: C:\Users\mike\source\repos\ConsoleApplication1\ConsoleApplication1.cpp
Assertion failed: !isNull() && "Cannot retrieve a NULL type pointer", file C:\src\llvm_package_1300-rc1\llvm-project\clang\include\clang/AST/Type.h, line 684
PLEASE submit a bug report to https://bugs.llvm.org/ and include the crash backtrace.
Stack dump:
0. Program arguments: "C:\Program Files\LLVM\bin\clang-tidy.exe" C:\Users\mike\source\repos\ConsoleApplication1\ConsoleApplication1.cpp -header-filter=.* -quiet -- --config C:\Users\mike\AppData\Local\Temp\tmp8376.tmp

  1. parser at end of file
    #​0 0x00007ff6df355306 C:\Program Files\LLVM\bin\clang-tidy.exe 0x1345306 (C:\Program Files\LLVM\bin\clang-tidy.exe+0x1345306)
    #​1 0x00007ff6df355306
    #​2 0x00007ff6df355306 (C:\Program Files\LLVM\bin\clang-tidy.exe+0x1345306)
    #​3 0x00007ff93a33caad (C:\WINDOWS\System32\ucrtbase.dll+0x6caad)
    #​4 0x00007ff93a33dab1 (C:\WINDOWS\System32\ucrtbase.dll+0x6dab1)
    #​5 0x00007ff93a33f435 C:\Program Files\LLVM\bin\clang-tidy.exe 0xc0b55 C:\Program Files\LLVM\bin\clang-tidy.exe 0xbd7ea
    #​6 0x00007ff93a33f435 C:\Program Files\LLVM\bin\clang-tidy.exe 0xbcc36 C:\Program Files\LLVM\bin\clang-tidy.exe 0xbcc36
    #​7 0x00007ff93a33f435 C:\Program Files\LLVM\bin\clang-tidy.exe 0xbcd53 C:\Program Files\LLVM\bin\clang-tidy.exe 0x98aad
    #​8 0x00007ff93a33f435 C:\Program Files\LLVM\bin\clang-tidy.exe 0x175d6b3 C:\Program Files\LLVM\bin\clang-tidy.exe 0x177a33b
    #​9 0x00007ff93a33f435 C:\Program Files\LLVM\bin\clang-tidy.exe 0x175cba2 C:\Program Files\LLVM\bin\clang-tidy.exe 0x175db0a
    #​10 0x00007ff93a33f435 C:\Program Files\LLVM\bin\clang-tidy.exe 0x1760ad5 C:\Program Files\LLVM\bin\clang-tidy.exe 0x175ddd6
    #​11 0x00007ff93a33f435 C:\Program Files\LLVM\bin\clang-tidy.exe 0x175eb7b C:\Program Files\LLVM\bin\clang-tidy.exe 0x175dc3e
    #​12 0x00007ff93a33f435 C:\Program Files\LLVM\bin\clang-tidy.exe 0x175eb7b C:\Program Files\LLVM\bin\clang-tidy.exe 0x175dc3e
    #​13 0x00007ff93a33f435 C:\Program Files\LLVM\bin\clang-tidy.exe 0x1764d9b C:\Program Files\LLVM\bin\clang-tidy.exe 0x175e2bc
    #​14 0x00007ff93a33f435 C:\Program Files\LLVM\bin\clang-tidy.exe 0x173f7ed C:\Program Files\LLVM\bin\clang-tidy.exe 0x1dc372c
    #​15 0x00007ff93a33f435 C:\Program Files\LLVM\bin\clang-tidy.exe 0x1f913c3 C:\Program Files\LLVM\bin\clang-tidy.exe 0x1dc8965
    #​16 0x00007ff93a33f435 C:\Program Files\LLVM\bin\clang-tidy.exe 0x1daa2b4 C:\Program Files\LLVM\bin\clang-tidy.exe 0x1827860
    #​17 0x00007ff93a33f435 C:\Program Files\LLVM\bin\clang-tidy.exe 0x184a429 C:\Program Files\LLVM\bin\clang-tidy.exe 0x1827711
    #​18 0x00007ff93a33f435 C:\Program Files\LLVM\bin\clang-tidy.exe 0x18268f7 C:\Program Files\LLVM\bin\clang-tidy.exe 0x18290cf
    #​19 0x00007ff93a33f435 C:\Program Files\LLVM\bin\clang-tidy.exe 0x184694a C:\Program Files\LLVM\bin\clang-tidy.exe 0x3404
    #​20 0x00007ff93a33f435 C:\Program Files\LLVM\bin\clang-tidy.exe 0x2387d40 (C:\WINDOWS\System32\ucrtbase.dll+0x6f435)
    #​21 0x00007ff93a33f435
    #​22 0x00007ff93a33f435 (C:\WINDOWS\System32\ucrtbase.dll+0x6f435)
    0x00007FF6DF355306 (0x000022DBB4F3D9E6 0x0000000100000000 0x0000000000000016 0x0000000000000000)
    0x00007FF93A33CAAD (0x0000000000000201 0x00007FF600000000 0x0000000000000000 0x0000006670F8ACA0), raise() + 0x1DD bytes(s)
    0x00007FF93A33DAB1 (0x00007FF900000003 0x00007FF900000003 0x00007FF6E039E6A2 0x00007FF6E039E610), abort() + 0x31 bytes(s)
    0x00007FF93A33F435 (0x00000000000002AC 0x00007FF6E039E6A2 0x0000016723A83DE0 0x0000006670F8B0A0), _get_wpgmptr() + 0x18B5 bytes(s)
    0x00007FF93A33F771 (0x0000000000000201 0x0000016723A91501 0x0000016723A83DE0 0x00000167215C0CC0), _wassert() + 0x71 bytes(s)
    0x00007FF6DE0D0B55 (0x0000006670F8B000 0x00006E6DAEF4582B 0x0000000000000000 0x0000000000000020)
    0x00007FF6DE0CD7EA (0x0000002000000400 0x0000010000000400 0x0004000900000000 0x00000000DE0CC000)
    0x00007FF6DE0CCC36 (0x00006E6D00000000 0x00006E6DAEF4477B 0x0000016700002161 0x00006E6DAEF444FB)
    0x00007FF6DE0CCC36 (0x0000040000000100 0x0010000000000200 0x0000010024AB7A00 0x0000000000000000)
    0x00007FF6DE0CCD53 (0x0000000000206040 0x00007FF6DF7578A5 0x0000006670F8BA30 0x000000000000004A)
    0x00007FF6DE0A8AAD (0x0000016724AE53E0 0x00007FF6DE05E6C9 0x00000000000023E0 0x00007FF93A2E2596)
    0x00007FF6DF76D6B3 (0x0000006670F8CB40 0x0000000070F8D000 0x000001670000004A 0x0000016723A915D8)
    0x00007FF6DF78A33B (0x000001672381F0E0 0x0000016700000000 0x00000167240BEBA0 0x0000006670F8CBC0)
    0x00007FF6DF76CBA2 (0x0000000000000000 0x0000000000003DE0 0x0000006670F8D058 0x0000006670F8CC90)
    0x00007FF6DF76DB0A (0x0000006670F8D060 0x0000000000000000 0x0000006670F8CBD0 0x0000000100000000)
    0x00007FF6DF770AD5 (0x0000000000000000 0x0000000000000000 0x0000006670F8D058 0x0000006670F8D058)
    0x00007FF6DF76DDD6 (0x00006E6DAEF43D3B 0x0000006670F8D058 0x00006E6DAEF43B7B 0x0000000000000000)
    0x00007FF6DF76EB7B (0x0000000000000008 0x00007FF600000006 0x00000167216ED920 0x00000167238BB360)
    0x00007FF6DF76DC3E (0x0000000000000000 0x0000000000000000 0x00006E6DAEF43A7B 0x0000000000000000)
    0x00007FF6DF76EB7B (0x0000006670F8D060 0x0000000000000008 0x00000167234C88C0 0x00000167216ED738)
    0x00007FF6DF76DC3E (0x0000000000D90142 0x00007FF600000000 0x00000167232BFC90 0x0000016721707940)
    0x00007FF6DF774D9B (0x0000006670F8D060 0x000001672350BAC0 0x00000167235148F0 0x0000000000000000)
    0x00007FF6DF76E2BC (0x0000000000000000 0x0000000000000011 0x0000000000000000 0x0000016724746400)
    0x00007FF6DF74F7ED (0x0000006670F8D250 0x0000000000000000 0x0000016723518910 0x0000006670F8D300)
    0x00007FF6DFDD372C (0x0000000000000000 0x00007FF6DFDB7F0F 0x0000000100000010 0x00006E6DAEF439DB)
    0x00007FF6DFFA13C3 (0x0000000000000000 0x00006E6DAEF439CB 0x0000000000000000 0x0000000000000000)
    0x00007FF6DFDD8965 (0x00000167232436D0 0x00007FF6DF78ED95 0x0000006670F8E500 0x0000000000000000)
    0x00007FF6DFDBA2B4 (0x00000167216AA0E0 0x0000006670F8D4E9 0x0000000000000020 0x00007FF6DFDA7AAA)
    0x00007FF6DF837860 (0x0000006670F8E360 0x00006E6DAEF434EB 0x0000000000000000 0x000000000000000F)
    0x00007FF6DF85A429 (0x0000016721633650 0x00000167216A60C0 0x0000016723261040 0x00007FF93A2E2596)
    0x00007FF6DF837711 (0x0000000023280101 0x0000000000000000 0x0000000000000165 0x000001672328E6F0)
    0x00007FF6DF8368F7 (0x0000000000000000 0x0000000000000000 0x000000000000005A 0x0000000000000080)
    0x00007FF6DF8390CF (0x0000006670F8E54C 0x0000006600000080 0x0000000000000000 0x0000000000000000)
    0x00007FF6DF85694A (0x000001672165CB18 0x0020006400000000 0x00007FF6E03AD863 0x0000000000000005)
    0x00007FF6DE013404 (0x0000000000000000 0x0000000000000000 0x0000000000000000 0x0000000000000000)
    0x00007FF6E0397D40 (0x0000000000000000 0x0000000000000000 0x0000000000000000 0x0000000000000000)
    0x00007FF93A6E7C24 (0x0000000000000000 0x0000000000000000 0x0000000000000000 0x0000000000000000), BaseThreadInitThunk() + 0x14 bytes(s)
    0x00007FF93C38D721 (0x0000000000000000 0x0000000000000000 0x0000000000000000 0x0000000000000000), RtlUserThreadStart() + 0x21 bytes(s)

Got errors.
VERBOSE: Cleaning up PCH temporaries:
VERBOSE:

@llvmbot
Copy link
Collaborator Author

llvmbot commented Aug 11, 2021

assigned to @whisperity

@llvmbot
Copy link
Collaborator Author

llvmbot commented Aug 11, 2021

Note: Sample source code can be reduced further to:

#include
auto main(int argc, char** argv) -> int
{
return (0);
}

Which will also crash (LLVM 13.0.0-rc1 Win64, Clang Power Tools 7.5.0, VS 2019 Update 11.0).

Assertion failed: !isNull() && "Cannot retrieve a NULL type pointer", file C:\src\llvm_package_1300-rc1\llvm-project\clang\include\clang/AST/Type.h, line 684
PLEASE submit a bug report to https://bugs.llvm.org/ and include the crash backtrace.
Stack dump:
0. Program arguments: "C:\Program Files\LLVM\bin\clang-tidy.exe" C:\Users\T0254692\source\repos\ConsoleApplication1\ConsoleApplication1.cpp -header-filter=.* -quiet -- --config C:\Users\T0254692\AppData\Local\Temp\tmpF92D.tmp

  1. parser at end of file
    #​0 0x00007ff6df355306 C:\Program Files\LLVM\bin\clang-tidy.exe 0x1345306 (C:\Program Files\LLVM\bin\clang-tidy.exe+0x1345306)
    #​1 0x00007ff6df355306
    #​2 0x00007ff6df355306 (C:\Program Files\LLVM\bin\clang-tidy.exe+0x1345306)
    #​3 0x00007ff93a33caad (C:\WINDOWS\System32\ucrtbase.dll+0x6caad)
    #​4 0x00007ff93a33dab1 (C:\WINDOWS\System32\ucrtbase.dll+0x6dab1)
    #​5 0x00007ff93a33f435 C:\Program Files\LLVM\bin\clang-tidy.exe 0xc0b55 C:\Program Files\LLVM\bin\clang-tidy.exe 0xbd7ea
    #​6 0x00007ff93a33f435 C:\Program Files\LLVM\bin\clang-tidy.exe 0xbcc36 C:\Program Files\LLVM\bin\clang-tidy.exe 0xbcc36
    #​7 0x00007ff93a33f435 C:\Program Files\LLVM\bin\clang-tidy.exe 0xbcd53 C:\Program Files\LLVM\bin\clang-tidy.exe 0x98aad
    #​8 0x00007ff93a33f435 C:\Program Files\LLVM\bin\clang-tidy.exe 0x175d6b3 C:\Program Files\LLVM\bin\clang-tidy.exe 0x177a33b
    #​9 0x00007ff93a33f435 C:\Program Files\LLVM\bin\clang-tidy.exe 0x175cba2 C:\Program Files\LLVM\bin\clang-tidy.exe 0x175db0a
    #​10 0x00007ff93a33f435 C:\Program Files\LLVM\bin\clang-tidy.exe 0x1760ad5 C:\Program Files\LLVM\bin\clang-tidy.exe 0x175ddd6
    #​11 0x00007ff93a33f435 C:\Program Files\LLVM\bin\clang-tidy.exe 0x175eb7b C:\Program Files\LLVM\bin\clang-tidy.exe 0x175dc3e
    #​12 0x00007ff93a33f435 C:\Program Files\LLVM\bin\clang-tidy.exe 0x175eb7b C:\Program Files\LLVM\bin\clang-tidy.exe 0x175dc3e
    #​13 0x00007ff93a33f435 C:\Program Files\LLVM\bin\clang-tidy.exe 0x1764d9b C:\Program Files\LLVM\bin\clang-tidy.exe 0x175e2bc
    #​14 0x00007ff93a33f435 C:\Program Files\LLVM\bin\clang-tidy.exe 0x173f7ed C:\Program Files\LLVM\bin\clang-tidy.exe 0x1dc372c
    #​15 0x00007ff93a33f435 C:\Program Files\LLVM\bin\clang-tidy.exe 0x1f913c3 C:\Program Files\LLVM\bin\clang-tidy.exe 0x1dc8965
    #​16 0x00007ff93a33f435 C:\Program Files\LLVM\bin\clang-tidy.exe 0x1daa2b4 C:\Program Files\LLVM\bin\clang-tidy.exe 0x1827860
    #​17 0x00007ff93a33f435 C:\Program Files\LLVM\bin\clang-tidy.exe 0x184a429 C:\Program Files\LLVM\bin\clang-tidy.exe 0x1827711
    #​18 0x00007ff93a33f435 C:\Program Files\LLVM\bin\clang-tidy.exe 0x18268f7 C:\Program Files\LLVM\bin\clang-tidy.exe 0x18290cf
    #​19 0x00007ff93a33f435 C:\Program Files\LLVM\bin\clang-tidy.exe 0x184694a C:\Program Files\LLVM\bin\clang-tidy.exe 0x3404
    #​20 0x00007ff93a33f435 C:\Program Files\LLVM\bin\clang-tidy.exe 0x2387d40 (C:\WINDOWS\System32\ucrtbase.dll+0x6f435)
    #​21 0x00007ff93a33f435
    #​22 0x00007ff93a33f435 (C:\WINDOWS\System32\ucrtbase.dll+0x6f435)
    0x00007FF6DF355306 (0x000090B0A10728A7 0x0000000100000000 0x0000000000000016 0x0000000000000000)
    0x00007FF93A33CAAD (0x0000000000000201 0x00007FF600000000 0x0000000000000000 0x000000E60A58AF80), raise() + 0x1DD bytes(s)
    0x00007FF93A33DAB1 (0x00007FF900000003 0x00007FF900000003 0x00007FF6E039E6A2 0x00007FF6E039E610), abort() + 0x31 bytes(s)
    0x00007FF93A33F435 (0x00000000000002AC 0x00007FF6E039E6A2 0x00000225D74FAE40 0x000000E60A58B380), _get_wpgmptr() + 0x18B5 bytes(s)
    0x00007FF93A33F771 (0x0000000000000101 0x00000225D74FB501 0x00000225D74FAE40 0x00000225D4F30CC0), _wassert() + 0x71 bytes(s)
    0x00007FF6DE0D0B55 (0x000000E60A58B2E0 0x0000E12F64B96094 0x0000000000000000 0x0000000000000020)
    0x00007FF6DE0CD7EA (0x0000022000000400 0x0000020000000400 0x0004000900000000 0x00000000DE0CC000)
    0x00007FF6DE0CCC36 (0x0000E12F00000000 0x0000E12F64B96244 0x0000022500002161 0x0000E12F64B967C4)
    0x00007FF6DE0CCC36 (0x0000040000000100 0x0010000000000200 0x00000100D834BDF0 0x0000000000000000)
    0x00007FF6DE0CCD53 (0x0000000000206040 0x00007FF6DF7578A5 0x000000E60A58BD10 0x000000000000004A)
    0x00007FF6DE0A8AAD (0x00000225D835E020 0x00007FF6DE05E6C9 0x00000000000023E0 0x00007FF93A2E2596)
    0x00007FF6DF76D6B3 (0x000000E60A58CE20 0x000000000A58D300 0x000002250000004A 0x00000225D74FB568)
    0x00007FF6DF78A33B (0x00000225D72A9060 0x0000022500000000 0x00000225D7B55050 0x000000E60A58CEA0)
    0x00007FF6DF76CBA2 (0x0000000000000000 0x0000000000003DE0 0x000000E60A58D338 0x000000E60A58CF70)
    0x00007FF6DF76DB0A (0x000000E60A58D340 0x0000000000000000 0x000000E60A58CEB0 0x0000000100000000)
    0x00007FF6DF770AD5 (0x0000000000000000 0x0000000000000000 0x000000E60A58D338 0x000000E60A58D338)
    0x00007FF6DF76DDD6 (0x0000E12F64B91D84 0x000000E60A58D338 0x0000E12F64B91E44 0x0000000000000000)
    0x00007FF6DF76EB7B (0x0000000000000008 0x00007FF600000006 0x00000225D504F150 0x00000225D73443A0)
    0x00007FF6DF76DC3E (0x0000000000000000 0x0000000000000000 0x0000E12F64B90144 0x0000000000000000)
    0x00007FF6DF76EB7B (0x000000E60A58D340 0x0000000000000008 0x00000225D6F53330 0x00000225D504EF68)
    0x00007FF6DF76DC3E (0x0000000000E70173 0x00007FF600000000 0x00000225D6DE0AB0 0x00000225D5069F00)
    0x00007FF6DF774D9B (0x000000E60A58D340 0x00000225D6F96090 0x00000225D6F9FED0 0x0000000000000000)
    0x00007FF6DF76E2BC (0x0000000000000000 0x0000000000000011 0x0000000000000000 0x00000225D77E7DF0)
    0x00007FF6DF74F7ED (0x000000E60A58D530 0x0000000000000000 0x00000225D6FA4210 0x000000E60A58D600)
    0x00007FF6DFDD372C (0x0000000000000000 0x00007FF6DFDB7F0F 0x0000000100000010 0x0000E12F64B900A4)
    0x00007FF6DFFA13C3 (0x0000000000000000 0x0000E12F64B900B4 0x0000000000000000 0x0000000000000000)
    0x00007FF6DFDD8965 (0x00000225D6D4EB50 0x00007FF6DF78ED95 0x000000E60A58E7E0 0x0000000000000000)
    0x00007FF6DFDBA2B4 (0x00000225D500DB90 0x000000E60A58D7C9 0x0000000000000020 0x00007FF6DFDA7AAA)
    0x00007FF6DF837860 (0x000000E60A58E640 0x0000E12F64B917D4 0x0000000000000000 0x000000000000000F)
    0x00007FF6DF85A429 (0x00000225D500A4B0 0x00000225D5006990 0x00000225D5011900 0x00007FF93A2E2596)
    0x00007FF6DF837711 (0x00000000D6D40101 0x0000000000000000 0x0000000000000113 0x00000225D6D55710)
    0x00007FF6DF8368F7 (0x0000000000000000 0x0000000000000000 0x000000000000005A 0x0000000000000080)
    0x00007FF6DF8390CF (0x000000E60A58E82C 0x000000E600000080 0x0000000000000000 0x0000000000000000)
    0x00007FF6DF85694A (0x00000225D4FBCC48 0x0020006400000000 0x00007FF6E03AD863 0x0000000000000005)
    0x00007FF6DE013404 (0x0000000000000000 0x0000000000000000 0x0000000000000000 0x0000000000000000)
    0x00007FF6E0397D40 (0x0000000000000000 0x0000000000000000 0x0000000000000000 0x0000000000000000)
    0x00007FF93A6E7C24 (0x0000000000000000 0x0000000000000000 0x0000000000000000 0x0000000000000000), BaseThreadInitThunk() + 0x14 bytes(s)
    0x00007FF93C38D721 (0x0000000000000000 0x0000000000000000 0x0000000000000000 0x0000000000000000), RtlUserThreadStart() + 0x21 bytes(s)

Got errors.
VERBOSE: Cleaning up PCH temporaries:
VERBOSE:

@llvmbot
Copy link
Collaborator Author

llvmbot commented Aug 11, 2021

In fact simply the following 1 liner (just including the vector header) will cause a crash (LLVM 13.0.0rc1 Wind64, VS 2019 Update 11.0, Clang Power Tools 7.5.0):

#include

VERBOSE: INVOKE: C:\Program Files\LLVM\bin"C:\Program Files\LLVM\bin\clang-tidy.exe"
"C:\Users\mike\source\repos\ConsoleApplication1\ConsoleApplication1.cpp" -header-filter="." -quiet --
-isystem"C:\Program Files (x86)\Microsoft Visual Studio\2019\Professional\VC\Tools\MSVC\14.29.30133\include"
-isystem"C:\Program Files (x86)\Microsoft Visual Studio\2019\Professional\VC\Tools\MSVC\14.29.30133\atlmfc\include"
-isystem"C:\Program Files (x86)\Microsoft Visual Studio\2019\Professional\VC\Auxiliary\VS\include" -isystem"C:\Program
Files (x86)\Windows Kits\10\Include\10.0.19041.0\ucrt" -isystem"C:\Program Files (x86)\Windows
Kits\10\Include\10.0.19041.0\um" -isystem"C:\Program Files (x86)\Windows Kits\10\Include\10.0.19041.0\shared"
-isystem"C:\Program Files (x86)\Windows Kits\10\Include\10.0.19041.0\winrt" -isystem"C:\Program Files (x86)\Windows
Kits\10\Include\10.0.19041.0\cppwinrt" -std=c++14 -Wall -fms-compatibility-version=19.10 -Wmicrosoft
-Wno-invalid-token-paste -Wno-unknown-pragmas -Wno-unused-value -m32 "-DUNICODE" "-D_UNICODE" "-D_MT" "-D_DLL"
"-DWIN32" "-DNDEBUG" "-D_CONSOLE" "-D_DEBUG_FUNCTIONAL_MACHINERY" -x c++
1: C:\Users\mike\source\repos\ConsoleApplication1\ConsoleApplication1.cpp
Assertion failed: !isNull() && "Cannot retrieve a NULL type pointer", file C:\src\llvm_package_1300-rc1\llvm-project\clang\include\clang/AST/Type.h, line 684
PLEASE submit a bug report to https://bugs.llvm.org/ and include the crash backtrace.
Stack dump:
0. Program arguments: "C:\Program Files\LLVM\bin\clang-tidy.exe" C:\Users\mike\source\repos\ConsoleApplication1\ConsoleApplication1.cpp -header-filter=.
-quiet -- --config C:\Users\mike\AppData\Local\Temp\tmp7ADE.tmp

  1. parser at end of file
    #​0 0x00007ff6df355306 C:\Program Files\LLVM\bin\clang-tidy.exe 0x1345306 (C:\Program Files\LLVM\bin\clang-tidy.exe+0x1345306)
    #​1 0x00007ff6df355306
    #​2 0x00007ff6df355306 (C:\Program Files\LLVM\bin\clang-tidy.exe+0x1345306)
    #​3 0x00007ff93a33caad (C:\WINDOWS\System32\ucrtbase.dll+0x6caad)
    #​4 0x00007ff93a33dab1 (C:\WINDOWS\System32\ucrtbase.dll+0x6dab1)
    #​5 0x00007ff93a33f435 C:\Program Files\LLVM\bin\clang-tidy.exe 0xc0b55 C:\Program Files\LLVM\bin\clang-tidy.exe 0xbd7ea
    #​6 0x00007ff93a33f435 C:\Program Files\LLVM\bin\clang-tidy.exe 0xbcc36 C:\Program Files\LLVM\bin\clang-tidy.exe 0xbcc36
    #​7 0x00007ff93a33f435 C:\Program Files\LLVM\bin\clang-tidy.exe 0xbcd53 C:\Program Files\LLVM\bin\clang-tidy.exe 0x98aad
    #​8 0x00007ff93a33f435 C:\Program Files\LLVM\bin\clang-tidy.exe 0x175d6b3 C:\Program Files\LLVM\bin\clang-tidy.exe 0x177a33b
    #​9 0x00007ff93a33f435 C:\Program Files\LLVM\bin\clang-tidy.exe 0x175cba2 C:\Program Files\LLVM\bin\clang-tidy.exe 0x175db0a
    #​10 0x00007ff93a33f435 C:\Program Files\LLVM\bin\clang-tidy.exe 0x1760ad5 C:\Program Files\LLVM\bin\clang-tidy.exe 0x175ddd6
    #​11 0x00007ff93a33f435 C:\Program Files\LLVM\bin\clang-tidy.exe 0x175eb7b C:\Program Files\LLVM\bin\clang-tidy.exe 0x175dc3e
    #​12 0x00007ff93a33f435 C:\Program Files\LLVM\bin\clang-tidy.exe 0x175eb7b C:\Program Files\LLVM\bin\clang-tidy.exe 0x175dc3e
    #​13 0x00007ff93a33f435 C:\Program Files\LLVM\bin\clang-tidy.exe 0x1764d9b C:\Program Files\LLVM\bin\clang-tidy.exe 0x175e2bc
    #​14 0x00007ff93a33f435 C:\Program Files\LLVM\bin\clang-tidy.exe 0x173f7ed C:\Program Files\LLVM\bin\clang-tidy.exe 0x1dc372c
    #​15 0x00007ff93a33f435 C:\Program Files\LLVM\bin\clang-tidy.exe 0x1f913c3 C:\Program Files\LLVM\bin\clang-tidy.exe 0x1dc8965
    #​16 0x00007ff93a33f435 C:\Program Files\LLVM\bin\clang-tidy.exe 0x1daa2b4 C:\Program Files\LLVM\bin\clang-tidy.exe 0x1827860
    #​17 0x00007ff93a33f435 C:\Program Files\LLVM\bin\clang-tidy.exe 0x184a429 C:\Program Files\LLVM\bin\clang-tidy.exe 0x1827711
    #​18 0x00007ff93a33f435 C:\Program Files\LLVM\bin\clang-tidy.exe 0x18268f7 C:\Program Files\LLVM\bin\clang-tidy.exe 0x18290cf
    #​19 0x00007ff93a33f435 C:\Program Files\LLVM\bin\clang-tidy.exe 0x184694a C:\Program Files\LLVM\bin\clang-tidy.exe 0x3404
    #​20 0x00007ff93a33f435 C:\Program Files\LLVM\bin\clang-tidy.exe 0x2387d40 (C:\WINDOWS\System32\ucrtbase.dll+0x6f435)
    #​21 0x00007ff93a33f435
    #​22 0x00007ff93a33f435 (C:\WINDOWS\System32\ucrtbase.dll+0x6f435)
    0x00007FF6DF355306 (0x00005BD13C5EDF48 0x0000000100000000 0x0000000000000016 0x0000000000000000)
    0x00007FF93A33CAAD (0x0000000000000201 0x00007FF600000000 0x0000000000000000 0x000000F4E2D8AAD0), raise() + 0x1DD bytes(s)
    0x00007FF93A33DAB1 (0x00007FF900000003 0x00007FF900000003 0x00007FF6E039E6A2 0x00007FF6E039E610), abort() + 0x31 bytes(s)
    0x00007FF93A33F435 (0x00000000000002AC 0x00007FF6E039E6A2 0x00000297B1304E40 0x000000F4E2D8AED0), _get_wpgmptr() + 0x18B5 bytes(s)
    0x00007FF93A33F771 (0x0000000000000101 0x00000297B1301501 0x00000297B1304E40 0x00000297AED30CC0), _wassert() + 0x71 bytes(s)
    0x00007FF6DE0D0B55 (0x000000F4E2D8AE30 0x00000C43FF8C9E7C 0x0000000000000000 0x0000000000000020)
    0x00007FF6DE0CD7EA (0x0000022000000400 0x0000020000000400 0x0004000900000000 0x00000000DE0CC000)
    0x00007FF6DE0CCC36 (0x00000C4300000000 0x00000C43FF8C9DCC 0x0000029700002161 0x00000C43FF8C814C)
    0x00007FF6DE0CCC36 (0x0000040000000100 0x0010000000000200 0x00000100B2144800 0x0000000000000000)
    0x00007FF6DE0CCD53 (0x0000000000206040 0x00007FF6DF7578A5 0x000000F4E2D8B860 0x000000000000004A)
    0x00007FF6DE0A8AAD (0x00000297B215FEB0 0x00007FF6DE05E6C9 0x00000000000023E0 0x00007FF93A2E2596)
    0x00007FF6DF76D6B3 (0x000000F4E2D8C970 0x00000000E2D8CE00 0x000002970000004A 0x00000297B1301528)
    0x00007FF6DF78A33B (0x00000297B106C070 0x0000029700000000 0x00000297B1919000 0x000000F4E2D8C9F0)
    0x00007FF6DF76CBA2 (0x0000000000000000 0x0000000000003DE0 0x000000F4E2D8CE88 0x000000F4E2D8CAC0)
    0x00007FF6DF76DB0A (0x000000F4E2D8CE90 0x0000000000000000 0x000000F4E2D8CA00 0x0000000100000000)
    0x00007FF6DF770AD5 (0x0000000000000000 0x0000000000000000 0x000000F4E2D8CE88 0x000000F4E2D8CE88)
    0x00007FF6DF76DDD6 (0x00000C43FF8CFB0C 0x000000F4E2D8CE88 0x00000C43FF8CF9CC 0x0000000000000000)
    0x00007FF6DF76EB7B (0x0000000000000008 0x00007FF600000006 0x00000297AEE6E910 0x00000297B110F360)
    0x00007FF6DF76DC3E (0x0000000000000000 0x0000000000000000 0x00000C43FF8CF8CC 0x0000000000000000)
    0x00007FF6DF76EB7B (0x000000F4E2D8CE90 0x0000000000000008 0x00000297B0D15930 0x00000297AEE6E728)
    0x00007FF6DF76DC3E (0x0000000000ED0173 0x00007FF600000000 0x00000297B0BEF320 0x00000297B0BA8000)
    0x00007FF6DF774D9B (0x000000F4E2D8CE90 0x00000297B0D60230 0x00000297B0D69060 0x0000000000000000)
    0x00007FF6DF76E2BC (0x0000000000000000 0x0000000000000011 0x0000000000000000 0x00000297B1294280)
    0x00007FF6DF74F7ED (0x000000F4E2D8D080 0x0000000000000000 0x00000297B0D6D260 0x000000F4E2D8D100)
    0x00007FF6DFDD372C (0x0000000000000000 0x00007FF6DFDB7F0F 0x0000000100000010 0x00000C43FF8CFE6C)
    0x00007FF6DFFA13C3 (0x0000000000000000 0x00000C43FF8CFE5C 0x0000000000000000 0x0000000000000000)
    0x00007FF6DFDD8965 (0x00000297AEE1F0D0 0x00007FF6DF78ED95 0x000000F4E2D8E330 0x0000000000000000)
    0x00007FF6DFDBA2B4 (0x00000297AEE294D0 0x000000F4E2D8D319 0x0000000000000020 0x00007FF6DFDA7AAA)
    0x00007FF6DF837860 (0x000000F4E2D8E190 0x00000C43FF8CF2BC 0x0000000000000000 0x000000000000000F)
    0x00007FF6DF85A429 (0x00000297B0B73430 0x00000297AEE27170 0x00000297AEE3D800 0x00007FF93A2E2596)
    0x00007FF6DF837711 (0x0000000000000101 0x0000000000000000 0x00000000000000C2 0x00000000B50000B5)
    0x00007FF6DF8368F7 (0x0000000000000000 0x0000000000000000 0x000000000000005A 0x0000000000000080)
    0x00007FF6DF8390CF (0x000000F4E2D8E37C 0x000000F400000080 0x0000000000000000 0x0000000000000000)
    0x00007FF6DF85694A (0x00000297AEDDE398 0x0020006400000000 0x00007FF6E03AD863 0x0000000000000005)
    0x00007FF6DE013404 (0x0000000000000000 0x0000000000000000 0x0000000000000000 0x0000000000000000)
    0x00007FF6E0397D40 (0x0000000000000000 0x0000000000000000 0x0000000000000000 0x0000000000000000)
    0x00007FF93A6E7C24 (0x0000000000000000 0x0000000000000000 0x0000000000000000 0x0000000000000000), BaseThreadInitThunk() + 0x14 bytes(s)
    0x00007FF93C38D721 (0x0000000000000000 0x0000000000000000 0x0000000000000000 0x0000000000000000), RtlUserThreadStart() + 0x21 bytes(s)

Got errors.
VERBOSE: Cleaning up PCH temporaries:
VERBOSE:

--- CLANG TIDY FINISHED ---

@whisperity
Copy link
Member

The assert message looks eerily similar to some recently reported bug 50995 and bug 51237. Those were fixed in the recent release in commit e097724.

This commit is not part of -rc1, and there is no -rc2 yet.

Unfortunately the stack trace is only noise because it doesn't contain any symbol information.

I cannot reproduce the issue itself on Linux, maybe because the STL implementation is different.
Unfortunately, I have no means of developing on Windows as I don't have a Windows release, but to pinpoint this faster, we can still gather a few pieces of information.

Could you please do the following:

  1. Try the analysis by disabling the bugprone-easily-swappable-parameters check. If it goes away, we've found our quarry.

  2. Create a FULLY PREPROCESSED input file where all the includes have already been resolved? On Unix, you can do this with gcc -E. Surely a similar mechanism exists for MSVC. (Or run Windows version of Clang?)
    Please upload this file as a comment.

  3. Run the analysis with the --debug flag given to Clang-Tidy. Please upload the output of Clang-Tidy when run with the debug flag too.

In addition, could you please try a newer version of Clang, preferably compiled from release/13.x as it stands right now? -rc1 was tagged Aug 03, the backport of the fix of bug 50995 was only merged Aug 05. :C

@llvmbot
Copy link
Collaborator Author

llvmbot commented Aug 12, 2021

Hi

Just followed up on this, trying again with VS 2019 Update 11, Clang Power Tools 7.5.0 and LLVM 13.0.0-rc1 Win64.

As requested, I tried the following simple file:

// Simple test:
#include

With the following Clang-Tidy options (as you suggested):
*,-bugprone-easily-swappable-parameters

I now seeing the following expected output:
warning: system include vector not allowed [llvmlibc-restrict-system-libc-headers]

There is no longer a crash, thus it looks like your comment, is correct:
"Could you please do the following:

  1. Try the analysis by disabling the bugprone-easily-swappable-parameters check. If it goes away, we've found our quarry."

Let me know if you need anything further, but it looks like you're right.
(Unfortunately I've not got the time / resources to build my own copies of llvm from source, but am more than happy to check in rc2 later).

@whisperity
Copy link
Member

Okay, then this is very likely a duplicate of bug #50339 .

Yes, meanwhile I realised that if you got zero useful symbol information, then you also don't have the --debug flag, unfortunately.

#include

Yes, but the thing is that, this file doesn't expand to the same thing for me, as it does for you, because we use different platforms and STL implementations. Even by going back to -rc1 I couldn't get a crash on Linux (before landing the checker we have done analysis of various open-source projects, some of which definitely used .)

So what I would like is the fully preprocessed input file. As in, where there are no more #define and #include calls. The compiler can generate it for you. An example for GCC and Linux is here: http://godbolt.org/z/1obzEP7vM

By adding the -E flag to the compile command (i.e. g++ -E foo.cpp) you can get the output post-preprocessing. I'm not sure what the corresponding flag for this on Windows would be.

But if you have Clang, the compiler binary (clang or clang++) available on your system, you could try "clang++ -E [your other flags] whatever.cpp".

@llvmbot
Copy link
Collaborator Author

llvmbot commented Aug 12, 2021

Results of preprocessing (zipped)
This is the zipped up output of preprocessing the following:
#include

@whisperity
Copy link
Member

Thanks! Unfortunately no matter how much I tinker with the flags on the command-line I'm getting a bunch of compile errors like "redefinition of '__vcrt_va_list_is_reference<_Ty &&>'" and such.

I tried C-Reduceing the thing too, but it always collapses to things like "struct a {}". It really does not want to get parsed for me. Trying to get into it manually is a huge mess, as the file is incredibly big for human editing.

Either way, I have a very huge suspicious as to what the issue was, let's see after -rc2's tagging if it will be truly fixed.

If not, I'll be in a real big problem as to how to even figure this out...

@llvmbot
Copy link
Collaborator Author

llvmbot commented Aug 13, 2021

Thats fine. I will test with 13.0.0-rc2 (Win64) when it comes.

@whisperity
Copy link
Member

Alrighty. I'm taking the bug on myself so I see it in the list. Let's hope -rc2 drops soon.

@tstellar
Copy link
Collaborator

This is a duplicate of another bug that has already been fixed?

@whisperity
Copy link
Member

This is a duplicate of another bug that has already been fixed?

It could be. (The error message itself is very similar and disabling the checker made the crash go away.) Unfortunately I can't locally reproduce the bug and the Windows stack trace is useless without symbols information. We'll only know once 13.0-rc2 hits and the original poster obtains a binary build (they expressed their inability to locally build Clang) of the new RC and tries it out.

While I can build Clang locally, I also do not have a Windows machine, and the Windows STL file is full of compile errors from a Linux Clang's point-of-view. (The preprocessed header creduces to empty file, even!)

@whisperity
Copy link
Member

Let me know if you need anything further, but it looks like you're right.
(Unfortunately I've not got the time / resources to build my own copies of
llvm from source, but am more than happy to check in rc2 later).

It seems 13-rc2 was tagged over the previous weekend. Could you please check this issue again, if a prebuilt release is already available?

@llvmbot
Copy link
Collaborator Author

llvmbot commented Sep 1, 2021

Hi I can confirm 1 Sep 2021

Using LLVM 13.0.0-rc2 (Win64) with VS 2019 Update 11.2 (note: no change in compiler headers since bug originally reported) and Clang Power Tools 7.5.1 on Windows 10 x64:

The bug does not occur any more. Clang-Tidy (13.0.0-rc2 Win64) does not crash parsing:

#include

and terminates correctly as expected.

Please consider the bug closed in Clang-Tidy 13.0.0-rc2 (as you'd hoped!)

Cheers,

Mike Diack

@llvmbot
Copy link
Collaborator Author

llvmbot commented Sep 1, 2021

Let me know if you need anything further, but it looks like you're right.
(Unfortunately I've not got the time / resources to build my own copies of
llvm from source, but am more than happy to check in rc2 later).

It seems 13-rc2 was tagged over the previous weekend. Could you please check
this issue again, if a prebuilt release is already available?

Verified fixed (1 Sep 2021 with 13.0.0-rc2 Win64) - see other comments for details. Good work!

@whisperity
Copy link
Member

Thank you!

*** This bug has been marked as a duplicate of bug #50339 ***

@tstellar
Copy link
Collaborator

tstellar commented Sep 2, 2021

Merged: e097724

@whisperity
Copy link
Member

The issue reported in this ticket was fixed by the same fix that fixed the original oldest bug report: a mismodelling was committed with the first version of the checker.

*** This bug has been marked as a duplicate of bug #50339 ***

@tstellar
Copy link
Collaborator

mentioned in issue #51489

@llvmbot llvmbot transferred this issue from llvm/llvm-bugzilla-archive Dec 11, 2021
This issue was closed.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bugzilla Issues migrated from bugzilla clang-tidy crash-on-invalid duplicate Resolved as duplicate
Projects
None yet
Development

No branches or pull requests

3 participants