Message ID | 24f4d89aafc682360eb2b37005096f4b5b31124f.1666258361.git.research_trasio@irq.a4lg.com |
---|---|
State | Committed |
Headers |
Return-Path: <gdb-patches-bounces+patchwork=sourceware.org@sourceware.org> X-Original-To: patchwork@sourceware.org Delivered-To: patchwork@sourceware.org Received: from server2.sourceware.org (localhost [IPv6:::1]) by sourceware.org (Postfix) with ESMTP id 840003838142 for <patchwork@sourceware.org>; Thu, 20 Oct 2022 09:40:20 +0000 (GMT) DKIM-Filter: OpenDKIM Filter v2.11.0 sourceware.org 840003838142 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=sourceware.org; s=default; t=1666258820; bh=yqe+9xqYRzEE8NhHHNPEgLOeyKin8uFA7n01D+cWxFg=; h=To:Subject:Date:In-Reply-To:References:List-Id:List-Unsubscribe: List-Archive:List-Post:List-Help:List-Subscribe:From:Reply-To:Cc: From; b=YmbJ9spmZh9QrQe9hGA6LgdXMd18MnMsUP89ZC50AAvjU5nC4+tjuSCqtHOtEdvks tJ/NeoMuMEept3GpRhy5Oi8UDuB7kgchPY0cR8PFN4GEh2ZdYIFUGyZNjqNjeOCFiM EwOW5KHllwtIH0KZefaZe5kNJaCzvxtQN2KTV+k4= X-Original-To: gdb-patches@sourceware.org Delivered-To: gdb-patches@sourceware.org Received: from mail-sender-0.a4lg.com (mail-sender.a4lg.com [153.120.152.154]) by sourceware.org (Postfix) with ESMTPS id A3B86395B820 for <gdb-patches@sourceware.org>; Thu, 20 Oct 2022 09:37:39 +0000 (GMT) DMARC-Filter: OpenDMARC Filter v1.4.1 sourceware.org A3B86395B820 Received: from [127.0.0.1] (localhost [127.0.0.1]) by mail-sender-0.a4lg.com (Postfix) with ESMTPSA id 0226C300089; Thu, 20 Oct 2022 09:37:37 +0000 (UTC) To: Tsukasa OI <research_trasio@irq.a4lg.com>, Andrew Burgess <aburgess@redhat.com>, Mike Frysinger <vapier@gentoo.org>, Nick Clifton <nickc@redhat.com> Subject: [PATCH 27/40] sim/ppc: Add extra parenthesis to avoid ambiguity Date: Thu, 20 Oct 2022 09:32:32 +0000 Message-Id: <24f4d89aafc682360eb2b37005096f4b5b31124f.1666258361.git.research_trasio@irq.a4lg.com> In-Reply-To: <cover.1666258361.git.research_trasio@irq.a4lg.com> References: <cover.1666258361.git.research_trasio@irq.a4lg.com> Mime-Version: 1.0 Content-Transfer-Encoding: 8bit X-Spam-Status: No, score=-12.1 required=5.0 tests=BAYES_00, DKIM_SIGNED, DKIM_VALID, DKIM_VALID_AU, GIT_PATCH_0, SPF_HELO_NONE, SPF_PASS, TXREP autolearn=ham autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on server2.sourceware.org X-BeenThere: gdb-patches@sourceware.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: Gdb-patches mailing list <gdb-patches.sourceware.org> List-Unsubscribe: <https://sourceware.org/mailman/options/gdb-patches>, <mailto:gdb-patches-request@sourceware.org?subject=unsubscribe> List-Archive: <https://sourceware.org/pipermail/gdb-patches/> List-Post: <mailto:gdb-patches@sourceware.org> List-Help: <mailto:gdb-patches-request@sourceware.org?subject=help> List-Subscribe: <https://sourceware.org/mailman/listinfo/gdb-patches>, <mailto:gdb-patches-request@sourceware.org?subject=subscribe> From: Tsukasa OI via Gdb-patches <gdb-patches@sourceware.org> Reply-To: Tsukasa OI <research_trasio@irq.a4lg.com> Cc: gdb-patches@sourceware.org Errors-To: gdb-patches-bounces+patchwork=sourceware.org@sourceware.org Sender: "Gdb-patches" <gdb-patches-bounces+patchwork=sourceware.org@sourceware.org> |
Series |
sim+gdb: Suppress warnings if built with Clang (big batch 1)
|
|
Commit Message
Tsukasa OI
Oct. 20, 2022, 9:32 a.m. UTC
Clang generates a warning if it considers that an expression is misleading due to a lack of parenthesis ("-Wparentheses"). On the default configuration, it causes a build failure (unless "--disable-werror" is specified). This commit adds extra parenthesis to avoid ambiguity. --- sim/ppc/altivec.igen | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
Comments
On 20 Oct 2022 09:32, Tsukasa OI wrote: > Clang generates a warning if it considers that an expression is misleading > due to a lack of parenthesis ("-Wparentheses"). > On the default configuration, it causes a build failure > (unless "--disable-werror" is specified). > > This commit adds extra parenthesis to avoid ambiguity. > --- > sim/ppc/altivec.igen | 2 +- > 1 file changed, 1 insertion(+), 1 deletion(-) > > diff --git a/sim/ppc/altivec.igen b/sim/ppc/altivec.igen > index 63fe95a53d5..eda7af9dd6a 100644 > --- a/sim/ppc/altivec.igen > +++ b/sim/ppc/altivec.igen > @@ -231,7 +231,7 @@ void::model-function::ppc_insn_vr_vscr:itable_index index, model_data *model_ptr > busy_ptr->vscr_busy = 1; > > if (out_vmask) > - busy_ptr->nr_writebacks = 1 + (PPC_ONE_BIT_SET_P(out_vmask)) ? 1 : 2; > + busy_ptr->nr_writebacks = (1 + (PPC_ONE_BIT_SET_P(out_vmask))) ? 1 : 2; fairly certain this is incorrect. this pretty much guarantees that "1" will always be used and never "2". Andrew posted a diff fix that i think is correct. -mike
On 2022/10/24 0:05, Mike Frysinger wrote: > On 20 Oct 2022 09:32, Tsukasa OI wrote: >> Clang generates a warning if it considers that an expression is misleading >> due to a lack of parenthesis ("-Wparentheses"). >> On the default configuration, it causes a build failure >> (unless "--disable-werror" is specified). >> >> This commit adds extra parenthesis to avoid ambiguity. >> --- >> sim/ppc/altivec.igen | 2 +- >> 1 file changed, 1 insertion(+), 1 deletion(-) >> >> diff --git a/sim/ppc/altivec.igen b/sim/ppc/altivec.igen >> index 63fe95a53d5..eda7af9dd6a 100644 >> --- a/sim/ppc/altivec.igen >> +++ b/sim/ppc/altivec.igen >> @@ -231,7 +231,7 @@ void::model-function::ppc_insn_vr_vscr:itable_index index, model_data *model_ptr >> busy_ptr->vscr_busy = 1; >> >> if (out_vmask) >> - busy_ptr->nr_writebacks = 1 + (PPC_ONE_BIT_SET_P(out_vmask)) ? 1 : 2; >> + busy_ptr->nr_writebacks = (1 + (PPC_ONE_BIT_SET_P(out_vmask))) ? 1 : 2; > > fairly certain this is incorrect. this pretty much guarantees that "1" will > always be used and never "2". > > Andrew posted a diff fix that i think is correct. > -mike I agree that. I kept the original semantics but this is definitely a bug (I think Andrew's fix is correct). I will leave it to Andrew (PATCH 05/10). Thanks, Tsukasa
diff --git a/sim/ppc/altivec.igen b/sim/ppc/altivec.igen index 63fe95a53d5..eda7af9dd6a 100644 --- a/sim/ppc/altivec.igen +++ b/sim/ppc/altivec.igen @@ -231,7 +231,7 @@ void::model-function::ppc_insn_vr_vscr:itable_index index, model_data *model_ptr busy_ptr->vscr_busy = 1; if (out_vmask) - busy_ptr->nr_writebacks = 1 + (PPC_ONE_BIT_SET_P(out_vmask)) ? 1 : 2; + busy_ptr->nr_writebacks = (1 + (PPC_ONE_BIT_SET_P(out_vmask))) ? 1 : 2; if (WITH_TRACE && ppc_trace[trace_model]) model_trace_altivec_make_busy(model_ptr, vr_mask, 0);