public inbox for gdb-prs@sourceware.org
help / color / mirror / Atom feed
* [Bug sim/18273] sim: various cppcheck warnings
       [not found] <bug-18273-4717@http.sourceware.org/bugzilla/>
@ 2015-04-19  5:48 ` vapier at gentoo dot org
  2015-04-24 14:44 ` cvs-commit at gcc dot gnu.org
                   ` (6 subsequent siblings)
  7 siblings, 0 replies; 8+ messages in thread
From: vapier at gentoo dot org @ 2015-04-19  5:48 UTC (permalink / raw)
  To: gdb-prs

https://sourceware.org/bugzilla/show_bug.cgi?id=18273

Mike Frysinger <vapier at gentoo dot org> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
                 CC|                            |vapier at gentoo dot org
          Component|binutils                    |sim
            Version|2.26 (HEAD)                 |HEAD
           Assignee|unassigned at sourceware dot org   |vapier at gentoo dot org
            Product|binutils                    |gdb
   Target Milestone|---                         |8.0
            Summary|cppcheck meets sim - five   |sim: various cppcheck
                   |bugs                        |warnings

--- Comment #1 from Mike Frysinger <vapier at gentoo dot org> ---
David Binderman also mentioned this warning:

[src/sim/common/sim-trace.c:1229]: (error) Dangerous usage of 'phase' (strncpy
doesn't always null-terminate it).

Source code is

  strncpy (phase, phase_wo_colon, SIZE_PHASE);
  strcat (phase, ":");

It might be worthwhile to make sure the string is always terminated.
Something like

  strncpy (phase, phase_wo_colon, SIZE_PHASE);
  phase[SIZE_PHASE-1] = '\0';
  strcat (phase, ":");

-- 
You are receiving this mail because:
You are on the CC list for the bug.


^ permalink raw reply	[flat|nested] 8+ messages in thread

* [Bug sim/18273] sim: various cppcheck warnings
       [not found] <bug-18273-4717@http.sourceware.org/bugzilla/>
  2015-04-19  5:48 ` [Bug sim/18273] sim: various cppcheck warnings vapier at gentoo dot org
@ 2015-04-24 14:44 ` cvs-commit at gcc dot gnu.org
  2015-04-24 14:46 ` nickc at redhat dot com
                   ` (5 subsequent siblings)
  7 siblings, 0 replies; 8+ messages in thread
From: cvs-commit at gcc dot gnu.org @ 2015-04-24 14:44 UTC (permalink / raw)
  To: gdb-prs

https://sourceware.org/bugzilla/show_bug.cgi?id=18273

--- Comment #3 from cvs-commit at gcc dot gnu.org <cvs-commit at gcc dot gnu.org> ---
The master branch has been updated by Nick Clifton <nickc@sourceware.org>:

https://sourceware.org/git/gitweb.cgi?p=binutils-gdb.git;h=de7669bfa507d78f7abfe3d219b5aee9f346235e

commit de7669bfa507d78f7abfe3d219b5aee9f346235e
Author: Nick Clifton <nickc@redhat.com>
Date:   Fri Apr 24 15:43:21 2015 +0100

    Fix typos in sim sources exposed by static analysis.

    bfin    PR 18273
        * bfin-sim.c (decode_dsp32alu_0): Remove spurious check for
        s == 1.

    erc32    PR 18273
        * exec.c (add32): Fix typo in check for overflow.

    igen    PR 18273
        * misc.c (a2i): Fix typos checking for uppercase letters.

-- 
You are receiving this mail because:
You are on the CC list for the bug.


^ permalink raw reply	[flat|nested] 8+ messages in thread

* [Bug sim/18273] sim: various cppcheck warnings
       [not found] <bug-18273-4717@http.sourceware.org/bugzilla/>
  2015-04-19  5:48 ` [Bug sim/18273] sim: various cppcheck warnings vapier at gentoo dot org
  2015-04-24 14:44 ` cvs-commit at gcc dot gnu.org
@ 2015-04-24 14:46 ` nickc at redhat dot com
  2015-04-24 15:17 ` dcb314 at hotmail dot com
                   ` (4 subsequent siblings)
  7 siblings, 0 replies; 8+ messages in thread
From: nickc at redhat dot com @ 2015-04-24 14:46 UTC (permalink / raw)
  To: gdb-prs

https://sourceware.org/bugzilla/show_bug.cgi?id=18273

Nick Clifton <nickc at redhat dot com> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
             Status|NEW                         |ASSIGNED
                 CC|                            |nickc at redhat dot com

--- Comment #4 from Nick Clifton <nickc at redhat dot com> ---
Hi David,

  Thanks very much for reporting this typos/bugs.

  I have checked in patches containing the revisions that you have suggested.

  Please feel free to post any more sim related typos that you uncover to this
PR.

Cheers
  Nick

-- 
You are receiving this mail because:
You are on the CC list for the bug.


^ permalink raw reply	[flat|nested] 8+ messages in thread

* [Bug sim/18273] sim: various cppcheck warnings
       [not found] <bug-18273-4717@http.sourceware.org/bugzilla/>
                   ` (2 preceding siblings ...)
  2015-04-24 14:46 ` nickc at redhat dot com
@ 2015-04-24 15:17 ` dcb314 at hotmail dot com
  2015-04-29 15:04 ` cvs-commit at gcc dot gnu.org
                   ` (3 subsequent siblings)
  7 siblings, 0 replies; 8+ messages in thread
From: dcb314 at hotmail dot com @ 2015-04-24 15:17 UTC (permalink / raw)
  To: gdb-prs

https://sourceware.org/bugzilla/show_bug.cgi?id=18273

--- Comment #5 from dcb <dcb314 at hotmail dot com> ---
>Thanks very much for reporting this typos/bugs.

You are welcome. Nice to know I'm not wasting my time ;->

>Please feel free to post any more sim related typos that you uncover to this PR.

Righto.

1.

[src/sim/moxie/interp.c:1250]: (error) Resource leak: f

Missing fclose on error path. Doesn't look very important to me.

2.

[src/sim/common/sim-fpu.c:1110]: (style) Unsigned variable 'fraction' can't be
negative so it is unnecessary to test it.

Source code is 

  if ((signed64) f->fraction >= 0)

Some () might help clarify meaning here. Static analysis tool cppcheck
might be getting confused here.

3.

[src/sim/common/sim-fpu.c:1264]: (style) Unsigned variable 'fraction' can't be
negative so it is unnecessary to test it.

Duplicate.

4.

[src/sim/erc32/sis.c:205]: (style) Expression is always false because 'else if'
condition matches previous condition at line 171.

5.

[src/sim/m68hc11/gencode.c:1469]: (style) Expression is always false because
'else if' condition matches previous condition at line 1460.

6.

[src/sim/ppc/hw_htab.c:552] -> [src/sim/ppc/hw_htab.c:552]: (style) Same
expression on both sides of '>='.

-- 
You are receiving this mail because:
You are on the CC list for the bug.


^ permalink raw reply	[flat|nested] 8+ messages in thread

* [Bug sim/18273] sim: various cppcheck warnings
       [not found] <bug-18273-4717@http.sourceware.org/bugzilla/>
                   ` (3 preceding siblings ...)
  2015-04-24 15:17 ` dcb314 at hotmail dot com
@ 2015-04-29 15:04 ` cvs-commit at gcc dot gnu.org
  2015-04-29 15:06 ` nickc at redhat dot com
                   ` (2 subsequent siblings)
  7 siblings, 0 replies; 8+ messages in thread
From: cvs-commit at gcc dot gnu.org @ 2015-04-29 15:04 UTC (permalink / raw)
  To: gdb-prs

https://sourceware.org/bugzilla/show_bug.cgi?id=18273

--- Comment #6 from cvs-commit at gcc dot gnu.org <cvs-commit at gcc dot gnu.org> ---
The master branch has been updated by Nick Clifton <nickc@sourceware.org>:

https://sourceware.org/git/gitweb.cgi?p=binutils-gdb.git;h=0a13382c8e708fd9eb15dbc81cedc35e6670090c

commit 0a13382c8e708fd9eb15dbc81cedc35e6670090c
Author: Nick Clifton <nickc@redhat.com>
Date:   Wed Apr 29 16:02:02 2015 +0100

    Fix problems in the sim sources discovered by running the cppcheck static
analysis tool.

    erc32       PR 18273
        * sis.c (main): Remove unreachable code.

    m68hc11     * gencode.c (gen_fetch_operands): Remove unreachable code.

    ppc * hw_htab.c (htab_map_binary): Fix overlap check.

    common      * sim-fpu.c (INLINE_SIM_FPU): Fix static analysis warning by
        increasing parenthesis around casts to signed values.

-- 
You are receiving this mail because:
You are on the CC list for the bug.


^ permalink raw reply	[flat|nested] 8+ messages in thread

* [Bug sim/18273] sim: various cppcheck warnings
       [not found] <bug-18273-4717@http.sourceware.org/bugzilla/>
                   ` (4 preceding siblings ...)
  2015-04-29 15:04 ` cvs-commit at gcc dot gnu.org
@ 2015-04-29 15:06 ` nickc at redhat dot com
  2015-10-11  7:59 ` cvs-commit at gcc dot gnu.org
  2015-10-11  8:02 ` vapier at gentoo dot org
  7 siblings, 0 replies; 8+ messages in thread
From: nickc at redhat dot com @ 2015-04-29 15:06 UTC (permalink / raw)
  To: gdb-prs

https://sourceware.org/bugzilla/show_bug.cgi?id=18273

--- Comment #7 from Nick Clifton <nickc at redhat dot com> ---
Hi David,

> [src/sim/moxie/interp.c:1250]: (error) Resource leak: f

Not worth bothering with IMHO.

> [src/sim/common/sim-fpu.c:1110]: (style) Unsigned variable 'fraction' can't
> be negative so it is unnecessary to test it.

Fixed by patch.

> [src/sim/erc32/sis.c:205]: (style) Expression is always false because 'else
> if' condition matches previous condition at line 171.

Fixed by patch.

> [src/sim/m68hc11/gencode.c:1469]: (style) Expression is always false because
> 'else if' condition matches previous condition at line 1460.

Possibly a real bug.  I am not familiar enough with the M68HC11 simulator to
know.  For now the patch suppresses the duplicate code, but leaves it present
in the sources with a comment added.

> [src/sim/ppc/hw_htab.c:552] -> [src/sim/ppc/hw_htab.c:552]: (style) Same
> expression on both sides of '>='.

Real bug :-) Fixed by patch.

Cheers
  Nick

-- 
You are receiving this mail because:
You are on the CC list for the bug.


^ permalink raw reply	[flat|nested] 8+ messages in thread

* [Bug sim/18273] sim: various cppcheck warnings
       [not found] <bug-18273-4717@http.sourceware.org/bugzilla/>
                   ` (5 preceding siblings ...)
  2015-04-29 15:06 ` nickc at redhat dot com
@ 2015-10-11  7:59 ` cvs-commit at gcc dot gnu.org
  2015-10-11  8:02 ` vapier at gentoo dot org
  7 siblings, 0 replies; 8+ messages in thread
From: cvs-commit at gcc dot gnu.org @ 2015-10-11  7:59 UTC (permalink / raw)
  To: gdb-prs

https://sourceware.org/bugzilla/show_bug.cgi?id=18273

--- Comment #8 from cvs-commit at gcc dot gnu.org <cvs-commit at gcc dot gnu.org> ---
The master branch has been updated by Michael Frysinger
<vapier@sourceware.org>:

https://sourceware.org/git/gitweb.cgi?p=binutils-gdb.git;h=7d8a636c9a234354c9b2ecf01b6e405bece190a1

commit 7d8a636c9a234354c9b2ecf01b6e405bece190a1
Author: Mike Frysinger <vapier@gentoo.org>
Date:   Sun Oct 11 03:56:22 2015 -0400

    sim: moxie: fix leakage in error path [BZ #18273]

    Reported-by: dcb <dcb314@hotmail.com>

-- 
You are receiving this mail because:
You are on the CC list for the bug.


^ permalink raw reply	[flat|nested] 8+ messages in thread

* [Bug sim/18273] sim: various cppcheck warnings
       [not found] <bug-18273-4717@http.sourceware.org/bugzilla/>
                   ` (6 preceding siblings ...)
  2015-10-11  7:59 ` cvs-commit at gcc dot gnu.org
@ 2015-10-11  8:02 ` vapier at gentoo dot org
  7 siblings, 0 replies; 8+ messages in thread
From: vapier at gentoo dot org @ 2015-10-11  8:02 UTC (permalink / raw)
  To: gdb-prs

https://sourceware.org/bugzilla/show_bug.cgi?id=18273

Mike Frysinger <vapier at gentoo dot org> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
             Status|ASSIGNED                    |RESOLVED
         Resolution|---                         |FIXED

--- Comment #9 from Mike Frysinger <vapier at gentoo dot org> ---
i think everything is covered now

-- 
You are receiving this mail because:
You are on the CC list for the bug.


^ permalink raw reply	[flat|nested] 8+ messages in thread

end of thread, other threads:[~2015-10-11  8:02 UTC | newest]

Thread overview: 8+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
     [not found] <bug-18273-4717@http.sourceware.org/bugzilla/>
2015-04-19  5:48 ` [Bug sim/18273] sim: various cppcheck warnings vapier at gentoo dot org
2015-04-24 14:44 ` cvs-commit at gcc dot gnu.org
2015-04-24 14:46 ` nickc at redhat dot com
2015-04-24 15:17 ` dcb314 at hotmail dot com
2015-04-29 15:04 ` cvs-commit at gcc dot gnu.org
2015-04-29 15:06 ` nickc at redhat dot com
2015-10-11  7:59 ` cvs-commit at gcc dot gnu.org
2015-10-11  8:02 ` vapier at gentoo dot org

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).