From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 12287 invoked by alias); 30 Jan 2008 23:06:33 -0000 Received: (qmail 12268 invoked by uid 22791); 30 Jan 2008 23:06:32 -0000 X-Spam-Check-By: sourceware.org Received: from smtp-out.google.com (HELO smtp-out.google.com) (216.239.45.13) by sourceware.org (qpsmtpd/0.31) with ESMTP; Wed, 30 Jan 2008 23:06:15 +0000 Received: from zps78.corp.google.com (zps78.corp.google.com [172.25.146.78]) by smtp-out.google.com with ESMTP id m0UN66Uf010494 for ; Wed, 30 Jan 2008 15:06:06 -0800 Received: from wa-out-1112.google.com (wahk40.prod.google.com [10.114.237.40]) by zps78.corp.google.com with ESMTP id m0UN6591008896 for ; Wed, 30 Jan 2008 15:06:05 -0800 Received: by wa-out-1112.google.com with SMTP id k40so887540wah.25 for ; Wed, 30 Jan 2008 15:06:05 -0800 (PST) Received: by 10.115.89.1 with SMTP id r1mr1564634wal.8.1201734365289; Wed, 30 Jan 2008 15:06:05 -0800 (PST) Received: by 10.115.107.7 with HTTP; Wed, 30 Jan 2008 15:06:05 -0800 (PST) Message-ID: Date: Thu, 31 Jan 2008 02:57:00 -0000 From: "Doug Evans" To: "Pierre Muller" Subject: Re: [RFA] BINOP_DIV and ptyp command Cc: gdb-patches@sourceware.org In-Reply-To: <000601c8638a$ba92aaf0$2fb800d0$@u-strasbg.fr> MIME-Version: 1.0 Content-Type: text/plain; charset=ISO-8859-1 Content-Transfer-Encoding: 7bit Content-Disposition: inline References: <20080130172852.4CFD413EC2@sebabeach.org> <000601c8638a$ba92aaf0$2fb800d0$@u-strasbg.fr> X-IsSubscribed: yes Mailing-List: contact gdb-patches-help@sourceware.org; run by ezmlm Precedence: bulk List-Id: List-Subscribe: List-Archive: List-Post: List-Help: , Sender: gdb-patches-owner@sourceware.org X-SW-Source: 2008-01/txt/msg00838.txt.bz2 On Jan 30, 2008 1:54 PM, Pierre Muller 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.