From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: 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 From: Mike Frysinger To: Tom de Vries Cc: gdb-patches@sourceware.org, andrew.burgess@embecosm.com 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-Spam-Status: No, score=-4.3 required=5.0 tests=BAYES_00, JMQ_SPF_NEUTRAL, KAM_DMARC_STATUS, RCVD_IN_MSPIKE_H3, RCVD_IN_MSPIKE_WL, SPF_HELO_PASS, SPF_PASS, TXREP autolearn=no autolearn_force=no version=3.4.2 X-Spam-Checker-Version: SpamAssassin 3.4.2 (2018-09-13) on server2.sourceware.org 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: , X-List-Received-Date: Wed, 19 May 2021 16:32:05 -0000 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