From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 20014 invoked by alias); 3 Sep 2004 14:53:30 -0000 Mailing-List: contact gdb-help@sources.redhat.com; run by ezmlm Precedence: bulk List-Subscribe: List-Archive: List-Post: List-Help: , Sender: gdb-owner@sources.redhat.com Received: (qmail 20005 invoked from network); 3 Sep 2004 14:53:29 -0000 Received: from unknown (HELO cpc4-oxfd5-5-0-cust12.oxfd.cable.ntl.com) (81.105.116.12) by sourceware.org with SMTP; 3 Sep 2004 14:53:29 -0000 Received: from [127.0.0.1] (localhost.localdomain [127.0.0.1]) by cpc4-oxfd5-5-0-cust12.oxfd.cable.ntl.com (8.12.11/8.12.11) with ESMTP id i83FCVdk008803 for ; Fri, 3 Sep 2004 16:12:32 +0100 Subject: Boolean equality (C++/Fortran) From: David Lecomber To: gdb@sources.redhat.com Content-Type: text/plain Message-Id: <1094224351.31231.59.camel@cpc4-oxfd5-5-0-cust12.oxfd.cable.ntl.com> Mime-Version: 1.0 Date: Fri, 03 Sep 2004 14:53:00 -0000 Content-Transfer-Encoding: 7bit X-SW-Source: 2004-09/txt/msg00035.txt.bz2 In valarith.c:value_binop, where v1 and v2 have been established to be values of type bool, we have: case BINOP_EQUAL: v = v1 == v2; break; case BINOP_NOTEQUAL: v = v1 != v2; break; Isn't this wrong? If you are mixing your compilers, then, at least for Fortran, the actual value of true can vary (1 or -1 I have so far seen). For C++ this is less likely to happen, and so far as I can tell changing the above would not harm anything. Does anyone have any comments on replacing the above with: case BINOP_EQUAL: v = !((!v1 && v2) || (v1 && !v2)); break; case BINOP_NOTEQUAL: v = (!v1 && v2) || (v1 && !v2); break; d.