We got asked by different people about when we will release Cppcheck-2.5. As there was problems in Cppcheck-2.4.
I think it would be good to focus on robustness from now on so we can release Cppcheck-2.5 soonish, maybe in a couple of weeks.
What regressions did we have in Cppcheck-2.4 that we should fix in Cppcheck-2.5? The ones I know about..
* crash was reported in chat that is already fixed in HEAD.
* misra addon problems (9.x)
* suppressions and compile database (https://sourceforge.net/p/cppcheck/discussion/general/thread/add5506807)
* include limits missing (https://sourceforge.net/p/cppcheck/discussion/general/thread/ab8d5e7d54/)
Does anybody have any feedback about other critical regressions/bugs?
If you would like to refer to this comment somewhere else in this project, copy and paste the following link:
I just ran this commit on our code base.
There are a bunch of new unreadVariable, uninitvar and knownConditionTrueFalse warnings, which seem to be TP at first glance.
I have found a minor FP, and there might be an instance of FP pointerOutOfBounds that I still need to investigate.
Since 2.4, we get a spurious ctuOneDefinitionRuleViolationfrom a header file that I can't isolate so far. Maybe cppcheck thinks that the header is included twice, despite the include guards?
If you would like to refer to this comment somewhere else in this project, copy and paste the following link:
As it turns out, ctuOneDefinitionRuleViolation disappears when --cppcheck-build-dir=MyDir is removed. I saw many files were created in MyDir, but the execution time did not improve at all. Is --cppcheck-build-dir supposed to work with the -j N option?
If you would like to refer to this comment somewhere else in this project, copy and paste the following link:
Compared to 2.3 I'm also seeing a regression in MISRA 8.2 and arrayIndexOutofBounds.
I need to try and create test cases for both of these but I believe they are false postive regressions. They do not occur in 2.3 and they are in 2.4 and HEAD.
Grrr...I tried to provide examples but the spambot protection is preventing me from posting them. I'll have to try and work on seeing if I can come up with some small test cases.
If you would like to refer to this comment somewhere else in this project, copy and paste the following link:
Nod. I was just marking the categories of regressions I'm seeing so they are on the list of things to look into.
Not having any luck with making a test case for 8.2. I'll probably have to add some sort of code in the script to dump out the tokens.
I'll need to look deeper into the OutOfBounds error and verify it really is a FP, but it doesn't happen in 2.3. So something changed between 2.3 and HEAD that affects it.
If you would like to refer to this comment somewhere else in this project, copy and paste the following link:
I attached my source code. Sorry it's quite messy since it's only for test, please just focus on the rule 8.2. My whole check results:
E:\Minh\Programming\Coding_Standard\MISRA\Misra_Check\c_test>cppcheck --dump Misra_Test.c
Checking Misra_Test.c ...
E:\Minh\Programming\Coding_Standard\MISRA\Misra_Check\c_test>python "C:\Program Files\Cppcheck\addons\misra.py" --rule-texts="E:\Cppcheck\misra_rules.txt" Misra_Test.c.dump
Checking Misra_Test.c.dump...
Checking Misra_Test.c.dump, config ...
[rule_test.h:4] (warning) Function types shall be in prototype form with named parameters (Required) [misra-c2012-8.2]
[Misra_Test.c:20] (warning) Function types shall be in prototype form with named parameters (Required) [misra-c2012-8.2]
[Misra_Test.c:25] (warning) Arrays shall not be partially initialized (Required) [misra-c2012-9.3]
[Misra_Test.c:25] (warning) An element of an object shall not be initialized more than once (Required) [misra-c2012-9.4]
[Misra_Test.c:26] (style) The comma operator should not be used (Advisory) [misra-c2012-12.3]
[Misra_Test.c:8] (warning) Expressions resulting from the expansion of macro parameters shall be enclosed in parentheses (Required) [misra-c2012-20.7]
[Misra_Test.c:4] (warning) The Standard Library input/output functions shall not be used (Required) [misra-c2012-21.6]
MISRA rules violations found:
Required: 6
Advisory: 1
MISRA rules violated:
misra-c2012-8.2 (-): 2
misra-c2012-9.3 (-): 1
misra-c2012-9.4 (-): 1
misra-c2012-12.3 (-): 1
misra-c2012-20.7 (-): 1
misra-c2012-21.6 (-): 1
E:\Minh\Programming\Coding_Standard\MISRA\Misra_Check\c_test>cppcheck --version
Cppcheck 2.4.1
I've downloaded sources and executed the following command: ./cppcheck --dump Misra_Test.c && addons/misra.py Misra_Test.c.dump.
With both cppcheck 2.4.1 and cppcheck from the main branch, I didn't get any false positives:
Checking Misra_Test.c ...
Checking Misra_Test.c.dump...
Checking Misra_Test.c.dump, config ...
[Misra_Test.c:25] (style) misra violation (use --rule-texts=<file> to get proper output) (Undefined) [misra-c2012-9.3]
[Misra_Test.c:25] (style) misra violation (use --rule-texts=<file> to get proper output) (Undefined) [misra-c2012-9.4]
[Misra_Test.c:26] (style) misra violation (use --rule-texts=<file> to get proper output) (Undefined) [misra-c2012-12.3]
[Misra_Test.c:8] (style) misra violation (use --rule-texts=<file> to get proper output) (Undefined) [misra-c2012-20.7]
[Misra_Test.c:4] (style) misra violation (use --rule-texts=<file> to get proper output) (Undefined) [misra-c2012-21.6]
MISRA rules violations found:
Undefined: 5
MISRA rules violated:
misra-c2012-9.3 (-): 1
misra-c2012-9.4 (-): 1
misra-c2012-12.3 (-): 1
misra-c2012-20.7 (-): 1
misra-c2012-21.6 (-): 1
That's very strange.
According to git blame, rule 8.2 was implemented in the single commit: 9786f1 and one follow-up minor fix that can't be related to false positives. So, I assume that false positives you reported are not related to the cppcheck version.
I'm not sure what else could be causing the problems.
Could you please also attach the dump file (Misra_Test.c.dump) you generated?
May be there some platform-dependent differences, because I'm on Linux, but but that would be strange.
If you would like to refer to this comment somewhere else in this project, copy and paste the following link:
These false positives occur only for dump files created with cppcheck 2.4.1. But MISRA addon in version 2.4.1 doesn't have rule 8.2, so, we need the an addon from the latest version of Cppcheck to reproduce the problem.
The good news is that if you use cppcheck from the main branch (or version 2.5, which is coming soon), these false positives will disappear.
If you would like to refer to this comment somewhere else in this project, copy and paste the following link:
But the bad news is that I'm running 2.5 and I also see a huge amount of 8.2 violations that appear to be false positive. I've isolated a few examples from a uart driver that I can post up.
$ cppcheck --addon=misra.py uart.c
Checking uart.c ...
uart.c:37:23: style: misra violation (use --rule-texts=<file> to get proper output)[misra-c2012-8.2]
void uart1_initialize(int baud)
^
uart.c:103:29: style: misra violation (use --rule-texts=<file> to get proper output)[misra-c2012-8.2]
bool uart1_polled_send_byte(uint8_t data)
^
Looks like the StopIteration exception may be fixed as I'm not seeing that any more however I still have a large amount of 8.2 messages. Many (but not all) seem to be related to C99 types. Here is a small file that triggers one.
We got asked by different people about when we will release Cppcheck-2.5. As there was problems in Cppcheck-2.4.
I think it would be good to focus on robustness from now on so we can release Cppcheck-2.5 soonish, maybe in a couple of weeks.
What regressions did we have in Cppcheck-2.4 that we should fix in Cppcheck-2.5? The ones I know about..
* crash was reported in chat that is already fixed in HEAD.
* misra addon problems (9.x)
* suppressions and compile database (https://sourceforge.net/p/cppcheck/discussion/general/thread/add5506807)
* include limits missing (https://sourceforge.net/p/cppcheck/discussion/general/thread/ab8d5e7d54/)
Does anybody have any feedback about other critical regressions/bugs?
I just ran this commit on our code base.
There are a bunch of new
unreadVariable
,uninitvar
andknownConditionTrueFalse
warnings, which seem to be TP at first glance.I have found a minor FP, and there might be an instance of FP
pointerOutOfBounds
that I still need to investigate.Since 2.4, we get a spurious
ctuOneDefinitionRuleViolation
from a header file that I can't isolate so far. Maybe cppcheck thinks that the header is included twice, despite the include guards?As it turns out,
ctuOneDefinitionRuleViolation
disappears when--cppcheck-build-dir=MyDir
is removed. I saw many files were created inMyDir
, but the execution time did not improve at all. Is--cppcheck-build-dir
supposed to work with the-j N
option?Compared to 2.3 I'm also seeing a regression in MISRA 8.2 and arrayIndexOutofBounds.
I need to try and create test cases for both of these but I believe they are false postive regressions. They do not occur in 2.3 and they are in 2.4 and HEAD.
Grrr...I tried to provide examples but the spambot protection is preventing me from posting them. I'll have to try and work on seeing if I can come up with some small test cases.
we would need some more code to reproduce these false positives.
misra-c2012-8.2: is the parser wrong for some reason maybe? I am pretty sure that the problem is not this specific code.
arrayIndexOutOfBounds: I cannot tell why Cppcheck thinks that loc is 255. I need more code.
Last edit: Daniel Marjamäki 2021-05-28
Nod. I was just marking the categories of regressions I'm seeing so they are on the list of things to look into.
Not having any luck with making a test case for 8.2. I'll probably have to add some sort of code in the script to dump out the tokens.
I'll need to look deeper into the OutOfBounds error and verify it really is a FP, but it doesn't happen in 2.3. So something changed between 2.3 and HEAD that affects it.
understood.. good!
There we go. I removed the file paths and spambot was happy.
I consider current cppcheck HEAD to be cppcheck-2.5-rc1
Does anybody see important regressions?
Richard could you check if the misra crash is fixed that is very important.
Last edit: Daniel Marjamäki 2021-06-12
Thanks for the update. Ill try to test tomorrow but if not then on Monday.
Hello! My goal is to release cppcheck-2.5 on saturday. If anybody see a problem please share it.
Last edit: Daniel Marjamäki 2021-06-15
Sorry it took me a so long to test.
The misra 9.2 StopIteration exception has not changed.
This should be fixed so please feel free to try again..
There are some known syntax/ast regressions:
https://trac.cppcheck.net/ticket/10317
https://trac.cppcheck.net/ticket/10309
https://trac.cppcheck.net/ticket/10034
It would be good to fix those before release as these can't be easily suppressed.
Hi,
When the function has no input parameter, I got false positive with misra-c2012-8.2.
[rule_test.h:4] (warning) Function types shall be in prototype form with named parameters (Required) [misra-c2012-8.2]
Hi,
Could you please add the source code of your example? I can't reproduce this using just the code of the rule_test.h from your screenshot.
The full cppcheck command you are using and the version of cppcheck will be also very helpful.
Hi,
I'm using Cppcheck 2.4.1.
The full cppcheck commands:
I attached my source code. Sorry it's quite messy since it's only for test, please just focus on the rule 8.2. My whole check results:
Thanks for the example.
But I can't reproduce this issue yet.
I've downloaded sources and executed the following command:
./cppcheck --dump Misra_Test.c && addons/misra.py Misra_Test.c.dump
.With both cppcheck 2.4.1 and cppcheck from the main branch, I didn't get any false positives:
That's very strange.
According to git blame, rule 8.2 was implemented in the single commit: 9786f1 and one follow-up minor fix that can't be related to false positives. So, I assume that false positives you reported are not related to the cppcheck version.
I'm not sure what else could be causing the problems.
Could you please also attach the dump file (Misra_Test.c.dump) you generated?
May be there some platform-dependent differences, because I'm on Linux, but but that would be strange.
Hi,
Thanks for response.
Sorry I forgot to mention that I'm using this file for Misra check.
https://github.com/jubnzv/cppcheck/blob/fix-misra-8-2-crash/addons/misra.py
I attached the dump file, please take a look.
Thanks
Last edit: Duong Nhat Minh 2021-06-17
I was able to reproduce the problem.
These false positives occur only for dump files created with cppcheck 2.4.1. But MISRA addon in version 2.4.1 doesn't have rule 8.2, so, we need the an addon from the latest version of Cppcheck to reproduce the problem.
The good news is that if you use cppcheck from the main branch (or version 2.5, which is coming soon), these false positives will disappear.
But the bad news is that I'm running 2.5 and I also see a huge amount of 8.2 violations that appear to be false positive. I've isolated a few examples from a uart driver that I can post up.
I should add that to get this I first have to apply the workaround I put up in the other thread to prevents the StopIteration issue I have.
Sorry for the late response. Here is a fix: https://github.com/danmar/cppcheck/pull/3306 .
Looks like the StopIteration exception may be fixed as I'm not seeing that any more however I still have a large amount of 8.2 messages. Many (but not all) seem to be related to C99 types. Here is a small file that triggers one.