[Simh] A few more bugs found

Mark Pizzolato - Info Comm Mark at infocomm.com
Thu Mar 22 15:19:23 EDT 2012


Hi Michael,

Thanks for doing this.  

I have fixed:
   scp.c
   sim_disk.c
   sim_console.c
   pdp11_xq.c (cleaned up the style issues, but the memory leak error was not correct)
   pdp11_xu.c (cleaned up most of the style issues, but the memory leak error was not correct)
   pdp18b_cpu.c (which operator takes precedence compare or cast? Extra parenthesis don't hurt).

Bob will be fixing the issues in id_pas.c, pdp1_cpu.c and pdp1_stddev.c

The realloc warnings in sim_txmr.c and scp.c are not issues.

The issues with sim_ether.c are either because the makefile merely builds it for every simulator and most don't use it and/or your build environment didn't have enough stuff available to turn on the various USE_TAP_NETWORK, USE_BSDTUNTAP, USE_VDE_NETWORK, etc. to actually have code which references most of these unreferenced variable cases.  These are OK.

I see a some things I can't find/understand:
VAX/vax_cpu.c:746: style: Same expression on both sides of '|'.
VAX/vax_cpu.c:747: style: Same expression on both sides of '|'.
VAX/vax_cpu.c:748: style: Same expression on both sides of '|'.
VAX/vax_cpu.c:749: style: Same expression on both sides of '|'.
VAX/vax_cpu.c:788: style: Same expression on both sides of '|'.
VAX/vax_cpu.c:840: style: Same expression on both sides of '|'.
VAX/vax_cpu.c:843: style: Same expression on both sides of '|'.
VAX/vax_cpu.c:915: style: Same expression on both sides of '|'.
VAX/vax_cpu.c:1013: style: Same expression on both sides of '|'.
VAX/vax_cpu.c:1097: style: Same expression on both sides of '|'.
VAX/vax_cpu.c:1146: style: Same expression on both sides of '|'.
VAX/vax_cpu.c:1200: style: Same expression on both sides of '|'.
VAX/vax_cpu.c:1249: style: Same expression on both sides of '|'.
VAX/vax_cpu.c:1303: style: Same expression on both sides of '|'.
VAX/vax_cpu.c:1352: style: Same expression on both sides of '|'.
VAX/vax_cpu.c:1402: style: Same expression on both sides of '|'.
VAX/vax_cpu.c:1478: style: Same expression on both sides of '|'.
VAX/vax_cpu.c:3393: style: Same expression on both sides of '|'.
/usr/include/alloca.h:33: style: Found obsolete function 'alloca'. It is recommended to use a variable length array.
/usr/include/stdio.h:632: style: Found obsolete function 'gets'. It is recommended to use the function 'fgets' instead
VAX/vax_mmu.c:484: style: Same expression on both sides of '&'.
VAX/vax_mmu.c:504: style: Same expression on both sides of '&'.
VAX/vax_sys.c:1254: style: Same expression on both sides of '|'.
VAX/vax_sys.c:1253: style: Same expression on both sides of '|'.
VAX/vax_sys.c:1300: style: Same expression on both sides of '|'.
VAX/vax_sys.c:1301: style: Same expression on both sides of '|'.
VAX/vax_sys.c:1323: style: Same expression on both sides of '|'.
VAX/vax_sys.c:1324: style: Same expression on both sides of '|'.
VAX/vax_sys.c:1326: style: Same expression on both sides of '|'.
VAX/vax_sys.c:1325: style: Same expression on both sides of '|'.
VAX/vax_sys.c:1336: style: Same expression on both sides of '|'.
VAX/vax_sys.c:1337: style: Same expression on both sides of '|'.
VAX/vax_sys.c:1339: style: Same expression on both sides of '|'.
VAX/vax_sys.c:1338: style: Same expression on both sides of '|'.
VAX/vax_sys.c:1349: style: Same expression on both sides of '|'.
VAX/vax_sys.c:1350: style: Same expression on both sides of '|'.
VAX/vax_sys.c:1351: style: Same expression on both sides of '|'.
VAX/vax_sys.c:1352: style: Same expression on both sides of '|'.
PDP11/pdp11_tq.c:746: style: Found duplicate if expressions.
PDP11/pdp11_tq.c:1823: style: Found duplicate if expressions.
VAX/vax_cmode.c:1195: style: Same expression on both sides of '|'.
VAX/vax_cmode.c:1217: style: Same expression on both sides of '|'.

I'll look at some of the rest of the issues in the other simulators, but there are some strange reports like the vax ones there as well.  If you can explain them, it would be useful.

- Mark

> -----Original Message-----
> From: simh-bounces at trailing-edge.com [mailto:simh-bounces at trailing-
> edge.com] On Behalf Of Michael Bloom
> Sent: Thursday, March 22, 2012 9:26 AM
> To: simh at trailing-edge.com
> Subject: Re: [Simh] A few more bugs found
> 
> 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
> >
> >
> 





More information about the Simh mailing list