Package: cppcheck
Version: 2.0-3
Severity: normal
X-Debbugs-Cc: 

-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA256

With --clang, Cppcheck seems to crash on a file as minimal as:
main(){}

Here is my gdb session from version 2.1-1:
Program received signal SIGSEGV, Segmentation fault.
0x00005555557df333 in Token::tokAt (this=0x0, index=index@entry=1) at 
./lib/token.cpp:348
348             tok = tok->next();
(gdb) bt
#0  0x00005555557df333 in Token::tokAt (this=0x0, index=index@entry=1) at 
./lib/token.cpp:348
#1  0x000055555579808a in Function::returnsReference (function=<optimized out>, 
unknown=unknown@entry=false) at ./lib/symboldatabase.cpp:2434
#2  0x000055555562799f in CheckAutoVariables::checkVarLifetimeScope 
(this=0x7fffffffc3b0, start=0x555555976cf0, end=0x555555976dc0)
at ./lib/checkautovariables.cpp:475
#3  0x00005555556285dd in CheckAutoVariables::checkVarLifetime 
(this=this@entry=0x7fffffffc3b0) at ./lib/checkautovariables.cpp:570
#4  0x0000555555628ccd in CheckAutoVariables::runChecks (this=<optimized out>, 
tokenizer=<optimized out>, settings=<optimized out>,
errorLogger=<optimized out>) at ./lib/checkautovariables.h:57
#5  0x0000555555704434 in CppCheck::checkNormalTokens (this=0x7fffffffcde0, 
tokenizer=...) at /usr/include/c++/9/ext/new_allocator.h:89
#6  0x000055555570cbd2 in CppCheck::check (this=this@entry=0x7fffffffcde0, 
path="hi.c") at ./lib/cppcheck.cpp:389
#7  0x000055555560342a in CppCheckExecutor::check_internal 
(this=0x7fffffffdcc0, cppcheck=..., argv=<optimized out>)
at ./cli/cppcheckexecutor.cpp:921
#8  0x00005555556038c2 in CppCheckExecutor::check (this=0x7fffffffdcc0, argc=3, 
argv=0x7fffffffe068) at ./cli/cppcheckexecutor.cpp:232
#9  0x00005555555eccce in main (argc=3, argv=0x7fffffffe068) at 
./cli/main.cpp:95

I do have Clang+LLVM 10 installed. The Cppcheck package doesn't hint to
install Clang, so please add Suggests: clang.

In a fresh snapshot.debian.org (20200531T211512Z) chroot, I've
found this crash also happens with 2.0-3. The version in Buster doesn't have
the --clang option. The crash does not happen if Clang is not installed.

- -- System Information:
Debian Release: bullseye/sid
  APT prefers testing
  APT policy: (500, 'testing'), (2, 'unstable'), (1, 'testing-debug'), (1, 
'experimental')
Architecture: amd64 (x86_64)
Foreign Architectures: i386

Kernel: Linux 5.7.0-1-amd64 (SMP w/2 CPU threads)
Kernel taint flags: TAINT_USER, TAINT_FIRMWARE_WORKAROUND
Locale: LANG=en_US.UTF-8, LC_CTYPE=en_US.UTF-8 (charmap=UTF-8), LANGUAGE not set
Shell: /bin/sh linked to /usr/bin/dash
Init: systemd (via /run/systemd/system)
LSM: AppArmor: enabled

Versions of packages cppcheck depends on:
ii  libc6             2.31-1
ii  libgcc-s1         10.1.0-6
ii  libpcre3          2:8.39-13
ii  libstdc++6        10.1.0-6
ii  libtinyxml2-8     8.0.0+dfsg-2
ii  python3           3.8.2-3
ii  python3-pygments  2.3.1+dfsg-4

cppcheck recommends no packages.

Versions of packages cppcheck suggests:
ii  cppcheck-gui  2.1-1

- -- no debconf information

-----BEGIN PGP SIGNATURE-----

iHUEARYIAB0WIQT287WtmxUhmhucNnhyvHFIwKstpwUCXx8tuwAKCRByvHFIwKst
p3qpAP9EwCIDT54nJCC/fVnextGcB+4jxQ+Mfwec6Ty4J9Tc0wEAzAs0w3zqJ+QQ
dyRZbdaRdgAaumnrPEbFHrrLcbNgowE=
=X0jS
-----END PGP SIGNATURE-----

Reply via email to