Ok, so I tried on Ubuntu Focal Fossa.
Looks like it might be a g++ compiler issue -- if I remove -O2, and use -g3 instead I get a clean result. When I added -O2 (or -O1) back as well as -g3 I see the crash the same as I reported originally.
I've just compiled on Jammy Jellyfish and I get similar behavior with g++ on there.
$ cppcheck --clang crash_cppcheck.cpp
Checking crash_cppcheck.cpp...
Segmentation fault (core dumped)
Would you be able to run this with a debugger attached?
After fixing some other issue, I get
But I'm on Windows, so who knows.
I fail to reproduce.
Could you please save the output from this command:
And attach it here.
Last edit: Daniel Marjamäki 2022-07-05
Ok, so I tried on Ubuntu Focal Fossa.
Looks like it might be a g++ compiler issue -- if I remove -O2, and use -g3 instead I get a clean result. When I added -O2 (or -O1) back as well as -g3 I see the crash the same as I reported originally.
I've just compiled on Jammy Jellyfish and I get similar behavior with g++ on there.
Similarly, with santize=address
Last edit: Neil Matthews 2022-07-06
I attach the output on Focal Fossa from
clang -fsyntax-only -Xclang -ast-dump -fno-color-diagnostics -x c++ crash_cppcheck.cpp
Last edit: Neil Matthews 2022-07-06
See https://sourceforge.net/p/cppcheck/discussion/development/thread/964c9efc46/
Looks like a nullptr dereference in
isUnknownType()
, but I can't reprodce it on Windows.