public inbox for binutils@sourceware.org
 help / color / mirror / Atom feed
* PATCH: remove impossible case from gas/expr.c:expr
@ 2006-10-24  7:06 Ben Elliston
  2006-10-25  6:20 ` Ian Lance Taylor
  0 siblings, 1 reply; 2+ messages in thread
From: Ben Elliston @ 2006-10-24  7:06 UTC (permalink / raw)
  To: binutils

A static analysis tool that I ran over gas picked this up.  It is
impossible for op_left to be O_add in the switch (op_left), as it is
within the body of this if:

1762:  else if (resultP->X_op == O_constant && right.X_op == O_constant)

However, earlier, we have another if condition that handles the
possibility of an O_add operator and resultP->X_op being a constant:

1753:  else if (op_left == O_add && resultP->X_op == O_constant)

Anyone disagree? :-)

Cheers, Ben


2006-10-24  Ben Elliston  <bje@au.ibm.com>

        * expr.c (expr): Don't handle impossible case O_add when switching
        on op_left.

Index: expr.c
===================================================================
RCS file: /cvs/src/src/gas/expr.c,v
retrieving revision 1.67
diff -u -p -r1.67 expr.c
--- expr.c      7 Jun 2006 11:27:57 -0000       1.67
+++ expr.c      24 Oct 2006 05:07:15 -0000
@@ -1785,7 +1785,6 @@ expr (int rankarg,                /* Larger # is highe
            case O_bit_or_not:          resultP->X_add_number |= ~v; break;
            case O_bit_exclusive_or:    resultP->X_add_number ^= v; break;
            case O_bit_and:             resultP->X_add_number &= v; break;
-           case O_add:                 resultP->X_add_number += v; break;
            case O_subtract:            resultP->X_add_number -= v; break;
            case O_eq:
              resultP->X_add_number =

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

* Re: PATCH: remove impossible case from gas/expr.c:expr
  2006-10-24  7:06 PATCH: remove impossible case from gas/expr.c:expr Ben Elliston
@ 2006-10-25  6:20 ` Ian Lance Taylor
  0 siblings, 0 replies; 2+ messages in thread
From: Ian Lance Taylor @ 2006-10-25  6:20 UTC (permalink / raw)
  To: Ben Elliston; +Cc: binutils

Ben Elliston <bje@au1.ibm.com> writes:

> A static analysis tool that I ran over gas picked this up.  It is
> impossible for op_left to be O_add in the switch (op_left), as it is
> within the body of this if:

That's a nice bit of analysis.

> 2006-10-24  Ben Elliston  <bje@au.ibm.com>
> 
>         * expr.c (expr): Don't handle impossible case O_add when switching
>         on op_left.

Please leave a comment behind, so that a couple of years from now
somebody comparing the list in expr.h with the list in expr.c won't
get confused.

OK with that change.

Thanks.

Ian

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

end of thread, other threads:[~2006-10-24 14:16 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2006-10-24  7:06 PATCH: remove impossible case from gas/expr.c:expr Ben Elliston
2006-10-25  6:20 ` Ian Lance Taylor

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).