This is the mail archive of the mailing list for the binutils project.

Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

PATCH: remove impossible case from gas/expr.c:expr

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

        * 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 =

Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]