[RFA] BINOP_DIV and ptyp command

Doug Evans dje@google.com
Thu Jan 31 02:57:00 GMT 2008


On Jan 30, 2008 1:54 PM, Pierre Muller <muller@ics.u-strasbg.fr> wrote:
> Doug, I like your patch but
> > +  else if (TYPE_CODE (type1) == TYPE_CODE_BOOL
> > +        && TYPE_CODE (type2) == TYPE_CODE_BOOL)
> > +    {
> > +      switch (op)
> > +     {
> > +     case BINOP_BITWISE_AND:
> > +     case BINOP_BITWISE_IOR:
> > +     case BINOP_BITWISE_XOR:
> > +        case BINOP_EQUAL:
> > +        case BINOP_NOTEQUAL:
> > +       break;
> > +     default:
> > +       error (_("Invalid operation on booleans."));
> > +     }
>
>   I would have expected that only
> BINOP_LOGICAL_OR and BINOP_LOGICAL_AND
> are valid for Booleans.
>   Am I wrong?

Note that expr1 &&/|| expr2 is handled at a higher level (to avoid
evaluating expr2 as appropriate).  I'm guessing bool op bool is
special cased in value_binop because in the languages where this is
used one doesn't want the result promoted.  At any rate the above is
basically just cut-n-paste-n-tweak from value_binop.   [I tried to not
change too much, I basically just moved some code around - the theory
being any preserved bugs can be fixed in a later pass if the general
patch is OK.]   As for why LOGICAL_AND/OR are missing here, I don't
know - presumably support for them hasn't been needed yet.



More information about the Gdb-patches mailing list