Open johnmcfarlane opened 4 years ago
I've narrowed the crash down to enabling of three rules:
When all three rules are disabled, the crash does not occur.
To reproduce, download the attached source file and run either clang-tidy v9 or v10 like so...
clang-tidy Downloads/source-file-cpp11.cpp
... and observe that Clang-Tidy crashes.
To show that excluding three of the clang-analyzer-osx rules circumvents the crash, amend the command...
clang-tidy Downloads/source-file-cpp11.cpp --checks="*,-clang-analyzer-osx.cocoa.RetainCount,-clang-analyzer-osx.cocoa.RetainCountBase,-clang-analyzer-osx.OSObjectRetainCount"
...and observe that Clang-Tidy completes without crashing.
I've updated the name of the issue accordingly.
@llvm/issue-subscribers-bug
Extended Description
Summary:
Clang-Tidy crashes from time to time with well-formed source code .
The crash happens on Clang 9.0.0 and recent 10.0.0. While reducing the input, I found that the problem went away in 10.0.0 but not with 9.0.0 so I don't know how to reduce further or whether this is a single issue.
Repro:
With the given source file, you can reproduce simply with
Versions:
9.0.0 version is stock Ubuntu 19.10 package...
10.0.0 is a local build...
llvm-project SHA is 4c6e5899859651d5f0907fc4d5752e616c1598c3 config: cmake -GNinja -DCMAKE_CXX_COMPILER_LAUNCHER=ccache -DCMAKE_BUILD_TYPE=MinSizeRel -DLLVM_ENABLE_PROJECTS="clang;compiler-rt;libcxx;libcxxabi;libunwind;clang-tools-extra" -DCMAKE_INSTALL_PREFIX=/home/john/llvm ../llvm-project/llvm/
Input source:
The input (attached) is preprocessor output which was generated with the command line:
where
Backtraces:
Version 9.0.0 output (no symbols):
john@carbon:~/ws/revision/build$ clang-tidy source-file-cpp11.cpp
0 0x00007fc01db5656f llvm::sys::PrintStackTrace(llvm::raw_ostream&) (/lib/x86_64-linux-gnu/libLLVM-9.so.1+0xa4256f)
1 0x00007fc01db54952 llvm::sys::RunSignalHandlers() (/lib/x86_64-linux-gnu/libLLVM-9.so.1+0xa40952)
2 0x00007fc01db56971 (/lib/x86_64-linux-gnu/libLLVM-9.so.1+0xa42971)
3 0x00007fc021328540 __restore_rt (/lib/x86_64-linux-gnu/libpthread.so.0+0x15540)
4 0x000000000168de1f (/usr/lib/llvm-9/bin/clang-tidy+0x168de1f)
5 0x0000000001696ebb (/usr/lib/llvm-9/bin/clang-tidy+0x1696ebb)
6 0x000000000168a0b7 (/usr/lib/llvm-9/bin/clang-tidy+0x168a0b7)
7 0x000000000169cabc (/usr/lib/llvm-9/bin/clang-tidy+0x169cabc)
8 0x00000000016cfec0 (/usr/lib/llvm-9/bin/clang-tidy+0x16cfec0)
9 0x00000000016d195a (/usr/lib/llvm-9/bin/clang-tidy+0x16d195a)
10 0x00000000016d0f22 (/usr/lib/llvm-9/bin/clang-tidy+0x16d0f22)
11 0x00000000016d0c4e (/usr/lib/llvm-9/bin/clang-tidy+0x16d0c4e)
12 0x00000000016d0a6a (/usr/lib/llvm-9/bin/clang-tidy+0x16d0a6a)
13 0x000000000141bff9 (/usr/lib/llvm-9/bin/clang-tidy+0x141bff9)
14 0x000000000141d2bd (/usr/lib/llvm-9/bin/clang-tidy+0x141d2bd)
15 0x000000000141d4d6 (/usr/lib/llvm-9/bin/clang-tidy+0x141d4d6)
16 0x000000000141e078 (/usr/lib/llvm-9/bin/clang-tidy+0x141e078)
17 0x0000000000958a32 (/usr/lib/llvm-9/bin/clang-tidy+0x958a32)
18 0x00000000009cf14c (/usr/lib/llvm-9/bin/clang-tidy+0x9cf14c)
19 0x00000000009e93b4 (/usr/lib/llvm-9/bin/clang-tidy+0x9e93b4)
20 0x00000000009d5dfa (/usr/lib/llvm-9/bin/clang-tidy+0x9d5dfa)
21 0x00000000007c534b (/usr/lib/llvm-9/bin/clang-tidy+0x7c534b)
22 0x00000000007bfbf7 (/usr/lib/llvm-9/bin/clang-tidy+0x7bfbf7)
23 0x0000000000b2033c (/usr/lib/llvm-9/bin/clang-tidy+0xb2033c)
24 0x0000000000c2e4d3 (/usr/lib/llvm-9/bin/clang-tidy+0xc2e4d3)
25 0x0000000000b09dc8 (/usr/lib/llvm-9/bin/clang-tidy+0xb09dc8)
26 0x0000000000ac8940 (/usr/lib/llvm-9/bin/clang-tidy+0xac8940)
27 0x0000000000798cf6 (/usr/lib/llvm-9/bin/clang-tidy+0x798cf6)
28 0x0000000000438f95 (/usr/lib/llvm-9/bin/clang-tidy+0x438f95)
29 0x0000000000798a66 (/usr/lib/llvm-9/bin/clang-tidy+0x798a66)
30 0x00000000007980ff (/usr/lib/llvm-9/bin/clang-tidy+0x7980ff)
31 0x0000000000799e8a (/usr/lib/llvm-9/bin/clang-tidy+0x799e8a)
32 0x0000000000435e95 (/usr/lib/llvm-9/bin/clang-tidy+0x435e95)
33 0x0000000000432fe3 (/usr/lib/llvm-9/bin/clang-tidy+0x432fe3)
34 0x00007fc01cbf31e3 __libc_start_main /build/glibc-t7JzpG/glibc-2.30/csu/../csu/libc-start.c:342:3
35 0x000000000043134e (/usr/lib/llvm-9/bin/clang-tidy+0x43134e)
Segmentation fault (core dumped)
Version 10.0.0:
john@carbon:~/ws/revision/build$ clang-tidy source-file-cpp11.cpp Stack dump:
Examples of crashes from CI run: https://travis-ci.org/johnmcfarlane/cnl/builds/656836507