Could you check which versions of Cppcheck are used? cppcheck --version should print it out.
I guess CentOS 6 uses an older version of Cppcheck than CentOS 7?
AFAIK this is not known to the Cppcheck team yet.
Does this happen only for one project? Maybe there is some strange encoding or so in a file.
It looks like Cppcheck crashes while it is loading the header files.
According to strace the file src/hed/acc/JobDescriptionParser/arc/compute/JobDescriptionParserPlugin.h does not exist. Is that true?
But that should not crash Cppcheck or stop it from analysing the rest.
If you would like to refer to this comment somewhere else in this project, copy and paste the following link:
It is true that the files do not exist, probably because this is an un-compiled version of the code. However, running with centos6 this does not happen.
I just however found out that it is when I add the --enable=all flag that I get the seg-fault.
Extract from gdb with bactrace:
gdb cppcheck --enable=all ./arc
........
Checking arc/src/hed/acc/JobDescriptionParser/XMLNodeRecover.cpp: HAVE_CONFIG_H...
80/624 files checked 14% done
Checking arc/src/hed/acc/JobDescriptionParser/XRSLParser.cpp ...
Program received signal SIGSEGV, Segmentation fault.
0x00000000005a0695 in isOppositeCond(bool, bool, Token const*, Token const*, Library const&, bool, bool, std::list<std::pair<Token const*, std::string>, std::allocator<std::pair<Token const*, std::string> > >*) ()
(gdb) thread apply all bt
Thread 1 (Thread 0x7ffff7fe8740 (LWP 18273)):
#0 0x00000000005a0695 in isOppositeCond(bool, bool, Token const*, Token const*, Library const&, bool, bool, std::list<std::pair<Token const*, std::string>, std::allocator<std::pair<Token const*, std::string> > >*) ()
#1 0x00000000004d3f10 in CheckCondition::multiCondition2() ()
#2 0x00000000004d51c4 in CheckCondition::runChecks(Tokenizer const*, Settings const*, ErrorLogger*) ()
#3 0x00000000006405db in CppCheck::checkNormalTokens(Tokenizer const&) ()
#4 0x0000000000644217 in CppCheck::checkFile(std::string const&, std::string const&, std::istream&) ()
#5 0x0000000000645864 in CppCheck::check(std::string const&) ()
#6 0x000000000045f49d in CppCheckExecutor::check_internal(CppCheck&, int, char const* const*) ()
#7 0x00000000004609de in CppCheckExecutor::check(int, char const* const*) ()
#8 0x0000000000444616 in main ()
(gdb)
If you would like to refer to this comment somewhere else in this project, copy and paste the following link:
Can you try checking only XRSLParser.cpp?
If the crash still happens can you provide the file or try to reduce the code and provide an example that crashes Cppcheck?
If you would like to refer to this comment somewhere else in this project, copy and paste the following link:
I am struggling getting cppcheck working on centos 7.
Is there a know issue and workaround?
strace gives:
For info: the same command works perfectly fine on centos 6.
Could you check which versions of Cppcheck are used?
cppcheck --version
should print it out.I guess CentOS 6 uses an older version of Cppcheck than CentOS 7?
AFAIK this is not known to the Cppcheck team yet.
Does this happen only for one project? Maybe there is some strange encoding or so in a file.
It looks like Cppcheck crashes while it is loading the header files.
According to strace the file
src/hed/acc/JobDescriptionParser/arc/compute/JobDescriptionParserPlugin.h
does not exist. Is that true?But that should not crash Cppcheck or stop it from analysing the rest.
I actually posted the same question some time back on the irc-channel, but I can not find back to it. There it seemed that the problem was known.
[centos@jenkins-ci ~]$ uname -a
Linux jenkins-ci.novalocal 3.10.0-957.5.1.el7.x86_64 #1 SMP Fri Feb 1 14:54:57 UTC 2019 x86_64 x86_64 x86_64 GNU/Linux
[centos@jenkins-ci ~]$ cppcheck --version
Cppcheck 1.87
It is true that the files do not exist, probably because this is an un-compiled version of the code. However, running with centos6 this does not happen.
I just however found out that it is when I add the --enable=all flag that I get the seg-fault.
Extract from gdb with bactrace:
And now with debug-info installed
Last edit: Maiken Pedersen 2019-03-06
Can you try checking only XRSLParser.cpp?
If the crash still happens can you provide the file or try to reduce the code and provide an example that crashes Cppcheck?
Hi, thanks for your reply.
Yes, when running just on this file it crashes.
Attaching. Thank you.
Thanks.
I could reproduce and created a ticket: https://trac.cppcheck.net/ticket/9027
Oh excellent, thank you.