From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from simark.ca by simark.ca with LMTP id knoqHoc9pWBoPgAAWB0awg (envelope-from ) for ; Wed, 19 May 2021 12:32:07 -0400 Received: by simark.ca (Postfix, from userid 112) id 6A4151F11C; Wed, 19 May 2021 12:32:07 -0400 (EDT) X-Spam-Checker-Version: SpamAssassin 3.4.2 (2018-09-13) on simark.ca X-Spam-Level: X-Spam-Status: No, score=-0.7 required=5.0 tests=DKIM_SIGNED,DKIM_VALID, DKIM_VALID_AU,MAILING_LIST_MULTI,RDNS_DYNAMIC,URIBL_BLOCKED autolearn=ham autolearn_force=no version=3.4.2 Received: from sourceware.org (ip-8-43-85-97.sourceware.org [8.43.85.97]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (2048 bits) server-digest SHA256) (No client certificate requested) by simark.ca (Postfix) with ESMTPS id B3FF91E54D for ; Wed, 19 May 2021 12:32:06 -0400 (EDT) Received: from server2.sourceware.org (localhost [IPv6:::1]) by sourceware.org (Postfix) with ESMTP id 460CB393F871; Wed, 19 May 2021 16:32:06 +0000 (GMT) DKIM-Filter: OpenDKIM Filter v2.11.0 sourceware.org 460CB393F871 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=sourceware.org; s=default; t=1621441926; bh=xDOaojuVH59QmD2rog5GwR634XBYCzHFQR9GpE+7Lsk=; h=Date:To:Subject:References:In-Reply-To:List-Id:List-Unsubscribe: List-Archive:List-Post:List-Help:List-Subscribe:From:Reply-To:Cc: From; b=dzoPSjn8aedp8gjhtdOjNWKdaNit3vj7BWSQ4vrP56byGlE5YHgAy8H3Qd87hIXmX mZrkoo8s8w30+SsO3WnyV8Fw93Wf5dp24Baw13En97b6dxm6clU3KXn0LpwsfV+rYj f0YMhj+lEEcKBISEgIMJqkHZtc6L3Igq4dlq398s= Received: from smtp.gentoo.org (smtp.gentoo.org [140.211.166.183]) by sourceware.org (Postfix) with ESMTP id B537A393F867 for ; Wed, 19 May 2021 16:32:03 +0000 (GMT) DMARC-Filter: OpenDMARC Filter v1.3.2 sourceware.org B537A393F867 Received: from vapier (localhost [127.0.0.1]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (No client certificate requested) by smtp.gentoo.org (Postfix) with ESMTPS id CB928340D2B; Wed, 19 May 2021 16:32:02 +0000 (UTC) Date: Wed, 19 May 2021 12:32:02 -0400 To: Tom de Vries Subject: Re: [PATCH] sim: ppc: fix some Wpointer-sign warnings Message-ID: Mail-Followup-To: Tom de Vries , gdb-patches@sourceware.org, andrew.burgess@embecosm.com References: <20210519104646.GA11845@delia> MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Disposition: inline In-Reply-To: <20210519104646.GA11845@delia> X-BeenThere: gdb-patches@sourceware.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: Gdb-patches mailing list List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , From: Mike Frysinger via Gdb-patches Reply-To: Mike Frysinger Cc: gdb-patches@sourceware.org Errors-To: gdb-patches-bounces@sourceware.org Sender: "Gdb-patches" On 19 May 2021 12:46, Tom de Vries wrote: > --- a/sim/ppc/hw_memory.c > +++ b/sim/ppc/hw_memory.c > @@ -190,7 +190,7 @@ hw_memory_init_address(device *me) > if (device_find_property(me, "available") != NULL) { > hw_memory_chunk **curr_chunk = &hw_memory->heap; > int cell_nr; > - unsigned_cell dummy; > + signed_cell dummy; > int nr_cells = device_find_integer_array_property(me, "available", 0, &dummy); this one is fine > @@ -199,9 +199,9 @@ hw_memory_init_address(device *me) > cell_nr += 2) { > hw_memory_chunk *new_chunk = ZALLOC(hw_memory_chunk); > device_find_integer_array_property(me, "available", cell_nr, > - &new_chunk->address); > + (signed_cell *)&new_chunk->address); > device_find_integer_array_property(me, "available", cell_nr + 1, > - &new_chunk->size); > + (signed_cell *)&new_chunk->size); > > --- a/sim/ppc/hw_opic.c > +++ b/sim/ppc/hw_opic.c > @@ -417,10 +417,12 @@ hw_opic_init_data(device *me) > } > if (!device_find_integer_array_property(me, "interrupt-ranges", > reg_nr * 2, > - &opic->isu_block[isb].int_number) > + (signed_cell *) > + &opic->isu_block[isb].int_number) > || !device_find_integer_array_property(me, "interrupt-ranges", > reg_nr * 2 + 1, > - &opic->isu_block[isb].range)) > + (signed_cell *) > + &opic->isu_block[isb].range)) these ones i'm not sure about. it does fix the warnings, and it doesn't change the status quo behavior, but i don't think it's the actual fix we would want. if the device tree has a negative number, it'll get converted to an unsigned number. i haven't thought hard as to what the right fix would look like here. i think we'd have to look at what other device tree users are doing like in boot loaders (e.g. u-boot) and in the linux kernel. -mike