[Simh] A few more bugs found

Michael Bloom mabloom at dslextreme.com
Thu Mar 22 12:25:40 EDT 2012


Yes,  I've been using "cppcheck".

You are absolutely right about the noise they can generate.  As 
supplied,  cppcheck has 211 pre-defined errors and warnings that it can 
generate.  The "--errorlist" option lists them all.  Every error/warning 
and class of error/warning has an id.  You can enable or suppress 
different ids on the command line, or in text files.  You can also 
extend the program by writing your own rules, either simply with regular 
expressions,  or using C++.   It's quite flexible.

To give you an idea,  I'm attaching a quick diff for the makefile that 
makes it easy to run cppcheck.  At the moment, I have it suppressing two 
kinds of messages, one that tells you that the scope of a specific 
variable can be reduced,  and the other warning that "scanf without 
field width limits can crash with huge input data".

I've also attached a sample of the output from using "make lint" to run 
cppcheck on the files currently in the master branch at github (as  of 
Wed afternoon).

If you want to give cppcheck a try, don't take it from the Ubuntu 
repository.  The version there (1.47)  died on some simh code when I 
tried it.   The current version (1.53) did not have that problem.

- michael

On Wed Mar 21 16:17:20 EDT,  Jason Armistead wrote:
> Just thinking out loud ...
>
> Has anyone run SIMH through any form of static code analysis tool, and
> would it perhaps uncover some more previously-undetected bugs ?
>
> In suggesting this, I realize that these static analysis tools often
> generate a lot of "noise" in their output too, but it might catch some
> of these issues that have escaped our eyes to date.
>
> Jason
>
>


-------------- next part --------------
A non-text attachment was scrubbed...
Name: lint.log
Type: text/x-log
Size: 98618 bytes
Desc: not available
URL: <http://mailman.trailing-edge.com/pipermail/simh/attachments/20120322/943f4358/attachment-0002.bin>
-------------- next part --------------
An embedded and charset-unspecified text was scrubbed...
Name: DIFF
URL: <http://mailman.trailing-edge.com/pipermail/simh/attachments/20120322/943f4358/attachment-0002.ksh>


More information about the Simh mailing list