This is the mail archive of the
gdb-patches@sourceware.org
mailing list for the GDB project.
Re: [RFC] logic change in m2-valprint.c
- From: "Michael Snyder" <msnyder at sonic dot net>
- To: "Daniel Jacobowitz" <drow at false dot org>
- Cc: <gdb-patches at sourceware dot org>, <gaius at glam dot ac dot uk>
- Date: Sun, 1 Jul 2007 08:54:19 -0700
- Subject: Re: [RFC] logic change in m2-valprint.c
- References: <16087.12.7.175.2.1183076995.squirrel@webmail.sonic.net> <20070701154831.GE10872@caradoc.them.org>
- Reply-to: "Michael Snyder" <msnyder at sonic dot net>
> On Thu, Jun 28, 2007 at 05:29:55PM -0700, Michael Snyder wrote:
> > I'm really not sure about this, call it a shot in the dark.
> >
> > The logic doesn't make sense as it is (the condition can't be true),
> > so I figured maybe the conditional had been reversed by mistake.
> >
> > Either that, or the two lines should be removed, 'cause they're dead.
> >
>
> > 2007-06-28 Michael Snyder <msnyder@access-company.com>
> >
> > * m2-valprint.c (m2_print_long_set): Logical condition reversed
> > (Coverity).
>
> It can't be backwards; this is trying to print "1" or "1, 2" but your
> change would make it print ", 1" and ", 12".
>
> I think it's also trying to shorten ranges to "{1..3, 6..7}". The
> bug's got to be in there somewhere. Why's the code dead? I'm not
> seeing it... element_seen can be reset by the bit clear case, and then
> we'll get into the test you're changing again.
'Cause we're not in a loop, and it's not a static variable.
The code is serial. At entry we set empty_set to one, and
then we test to see if it's zero. It can't be zero.