-
Notifications
You must be signed in to change notification settings - Fork 11.8k
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
Comments
assigned to @whisperity |
Note: Sample source code can be reduced further to: #include 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
Got errors. |
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"
Got errors. --- CLANG TIDY FINISHED --- |
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. Could you please do the following:
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 |
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: With the following Clang-Tidy options (as you suggested): I now seeing the following expected output: There is no longer a crash, thus it looks like your comment, is correct:
Let me know if you need anything further, but it looks like you're right. |
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
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 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". |
Results of preprocessing (zipped) |
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... |
Thats fine. I will test with 13.0.0-rc2 (Win64) when it comes. |
Alrighty. I'm taking the bug on myself so I see it in the list. Let's hope -rc2 drops soon. |
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!) |
It seems 13-rc2 was tagged over the previous weekend. Could you please check this issue again, if a prebuilt release is already available? |
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 |
Verified fixed (1 Sep 2021 with 13.0.0-rc2 Win64) - see other comments for details. Good work! |
Thank you! *** This bug has been marked as a duplicate of bug #50339 *** |
Merged: e097724 |
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 *** |
mentioned in issue #51489 |
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;
}
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
#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:
The text was updated successfully, but these errors were encountered: