From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from us-smtp-delivery-124.mimecast.com (us-smtp-delivery-124.mimecast.com [170.10.129.124]) by sourceware.org (Postfix) with ESMTPS id CAAEC3858D28 for ; Wed, 24 Jan 2024 20:52:29 +0000 (GMT) DMARC-Filter: OpenDMARC Filter v1.4.2 sourceware.org CAAEC3858D28 Authentication-Results: sourceware.org; dmarc=pass (p=none dis=none) header.from=redhat.com Authentication-Results: sourceware.org; spf=pass smtp.mailfrom=redhat.com ARC-Filter: OpenARC Filter v1.0.0 sourceware.org CAAEC3858D28 Authentication-Results: server2.sourceware.org; arc=none smtp.remote-ip=170.10.129.124 ARC-Seal: i=1; a=rsa-sha256; d=sourceware.org; s=key; t=1706129551; cv=none; b=QcwkH02GgHoxzS4Uaos+lJAHjjhlhnToWYtScN21GF5MbkbGcyvkDI6qZ1+KW0h9etRaHkeC6xs0RW2nxsYEZlRiTT9CrOVwEsShkk7vF/QXrpyyGg1/VSiWAGcH6QXsYc7tIErjeaLtN2v8k+DYigbJ2+yNCP+bjVbBT049CvY= ARC-Message-Signature: i=1; a=rsa-sha256; d=sourceware.org; s=key; t=1706129551; c=relaxed/simple; bh=sTFw2FR4zCjp+GZ71rHSxYWXXXojE6vSVtvN2bsOkPM=; h=DKIM-Signature:Message-ID:Date:MIME-Version:Subject:To:From; b=vChtHjBRO3cPmKkGT6vrk2Ou4eyn5pXQlVBe7xB1UlA5tlVoWW3wRrtt/z3SJDJahqftNkSd/4q+kyngVeZmqLSHR39PSNOtBepTOj3NYh5xYPruuL8ISQh9ig103R6XHNnCNf2qaTDo+iEZ/9wk5hIFUMnmdNm+mx5cewvA6rI= ARC-Authentication-Results: i=1; server2.sourceware.org DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1706129549; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=1YR6C3ttodyDLDy5iJA39DThlENkEt7BRl9izE748n4=; b=dojuvidZagGO0X1rEd7c2FPwN0+ghS+aFtDXj7ANY+WKiiCIkOq853sUN8t709Fz4JklTh IgdAE7Wc5ATq109Kjc5Xo4Yeur5kATOw2Ku4vphi8DaRifWRJX41xNS7a/qx/8kFuZoPbQ fbcqohrYFFq8CW+6JqH1zA2ghyiZzfg= Received: from mail-qv1-f72.google.com (mail-qv1-f72.google.com [209.85.219.72]) by relay.mimecast.com with ESMTP with STARTTLS (version=TLSv1.3, cipher=TLS_AES_256_GCM_SHA384) id us-mta-199-fi4PeVk-MqiGOGuWjUH03A-1; Wed, 24 Jan 2024 15:52:27 -0500 X-MC-Unique: fi4PeVk-MqiGOGuWjUH03A-1 Received: by mail-qv1-f72.google.com with SMTP id 6a1803df08f44-6800aa45af1so86596446d6.3 for ; Wed, 24 Jan 2024 12:52:26 -0800 (PST) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1706129546; x=1706734346; h=content-transfer-encoding:in-reply-to:from:references:to :content-language:subject:user-agent:mime-version:date:message-id :x-gm-message-state:from:to:cc:subject:date:message-id:reply-to; bh=1YR6C3ttodyDLDy5iJA39DThlENkEt7BRl9izE748n4=; b=jPBouY26vYg9NYUUZ779mHqJXp0R4c+YKvi1tKcICNgMYfI9i6lItu6LjpOrX9Mq1G 0p55xu56Kbjh6rCbnkjlXkFaOH9EtigoOR2BtTQluwUjGlvjd9u9XDdiPvxtDc29mLGY Zc4gdzlQXI84V93aG1lPgE2WvoL1DkexOXxqOgChUnt37WfP1HKbjq6L4kXp5TpfIW4N 7AK+Im6ySjD9ZBQBu05IHbo7KDbAeWWrydBs0HWATf9WHWWs/7GrgxMRUDQKX/JDNf7m S9K5gZQKEOOkhE5UlHN9Xc6xVAt4EUaiNHX1TFzxWIPvPjz/BQHg+f/RXTTrXzNViyjd ac9w== X-Gm-Message-State: AOJu0Yz/Q52xWdXUm1Wkc7lXF6EkcV/SXpaNMDVZvbuVZa8HLmW0feLm UsZmHlYSRZwvOWy0yBV1aYG6vUGkrhH7cVu1tV9bMEPmWsPTxqMkIjljJK/cBpyP+afgvAuHkK4 oc/376Jc4qw+4VO5TPP0skEqfml+2ikpaufhMerrpzCwBRKc0FLvaqVU= X-Received: by 2002:a05:6214:4110:b0:686:aed4:aded with SMTP id kc16-20020a056214411000b00686aed4adedmr1557541qvb.65.1706129546591; Wed, 24 Jan 2024 12:52:26 -0800 (PST) X-Google-Smtp-Source: AGHT+IGQrvntqrNdzPxIXXfzrRvwuBF2cl7A/MySb9ibvV+65HfFsQy6KrO4Cn5HytblDVGT51PqpA== X-Received: by 2002:a05:6214:4110:b0:686:aed4:aded with SMTP id kc16-20020a056214411000b00686aed4adedmr1557534qvb.65.1706129546298; Wed, 24 Jan 2024 12:52:26 -0800 (PST) Received: from [192.168.1.108] (130-44-146-16.s12558.c3-0.arl-cbr1.sbo-arl.ma.cable.rcncustomer.com. [130.44.146.16]) by smtp.gmail.com with ESMTPSA id v3-20020a0ced43000000b006843f949b29sm4802504qvq.16.2024.01.24.12.52.25 (version=TLS1_3 cipher=TLS_AES_128_GCM_SHA256 bits=128/128); Wed, 24 Jan 2024 12:52:25 -0800 (PST) Message-ID: <4e887d3d-581d-42cc-82dd-e5e2483f0d3d@redhat.com> Date: Wed, 24 Jan 2024 15:52:24 -0500 MIME-Version: 1.0 User-Agent: Mozilla Thunderbird Subject: Re: [patch] PR 81271: gcc/cp/lex.c:116: wrong condition ? To: Jasmine Tang , gcc-patches@gcc.gnu.org References: From: Jason Merrill In-Reply-To: X-Mimecast-Spam-Score: 0 X-Mimecast-Originator: redhat.com Content-Language: en-US Content-Type: text/plain; charset=UTF-8; format=flowed Content-Transfer-Encoding: 7bit X-Spam-Status: No, score=-6.9 required=5.0 tests=BAYES_00,DKIMWL_WL_HIGH,DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,RCVD_IN_DNSWL_NONE,RCVD_IN_MSPIKE_H4,RCVD_IN_MSPIKE_WL,SPF_HELO_NONE,SPF_NONE,TXREP,T_SCC_BODY_TEXT_LINE autolearn=ham autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on server2.sourceware.org List-Id: On 1/24/24 00:57, Jasmine Tang wrote: > Change the style from & to && to reflect boolean result with boolean > operation (instead of bitwise operation) > > David Binderman 2017-07-01 13:24:44 UTC > > trunk/gcc/cp/lex.c:116]: (style) Boolean result is used in bitwise operation. Clarify expression with parentheses. > > Source code is > > gcc_checking_assert (!IDENTIFIER_KIND_BIT_2 (id) > & !IDENTIFIER_KIND_BIT_1 (id) > & !IDENTIFIER_KIND_BIT_0 (id)); > > Maybe better code > > gcc_checking_assert (!IDENTIFIER_KIND_BIT_2 (id) > && !IDENTIFIER_KIND_BIT_1 (id) > && !IDENTIFIER_KIND_BIT_0 (id)); > Since the _BIT_n macros all produce either 0 or 1, bitwise & has the same meaning as &&, except possibly faster because it doesn't involve the shortcut semantics of &&. I notice the warning suggests "Clarify expression with parentheses." I suspect that means along the lines of IDENTIFIER_KEYWORD_P and such in cp-tree.h, where the ! expression is parenthesized: > #define IDENTIFIER_KEYWORD_P(NODE) \ > ((!IDENTIFIER_KIND_BIT_2 (NODE)) \ > & (!IDENTIFIER_KIND_BIT_1 (NODE)) \ > & IDENTIFIER_KIND_BIT_0 (NODE)) Does doing that quiet the warning? Jason