From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from arjuna.pair.com (arjuna.pair.com [209.68.5.131]) by sourceware.org (Postfix) with ESMTPS id 84AA83858407 for ; Sat, 22 Oct 2022 01:59:57 +0000 (GMT) DMARC-Filter: OpenDMARC Filter v1.4.1 sourceware.org 84AA83858407 Authentication-Results: sourceware.org; dmarc=none (p=none dis=none) header.from=bitrange.com Authentication-Results: sourceware.org; spf=pass smtp.mailfrom=bitrange.com Received: by arjuna.pair.com (Postfix, from userid 3006) id 460758A753; Fri, 21 Oct 2022 21:59:57 -0400 (EDT) Received: from localhost (localhost [127.0.0.1]) by arjuna.pair.com (Postfix) with ESMTP id 42EF68A741; Fri, 21 Oct 2022 21:59:57 -0400 (EDT) Date: Fri, 21 Oct 2022 21:59:57 -0400 (EDT) From: Hans-Peter Nilsson X-X-Sender: hp@arjuna.pair.com To: Tsukasa OI cc: Andrew Burgess , Mike Frysinger , Nick Clifton , binutils@sourceware.org Subject: Re: [PATCH 04/40] cpu/cris: Initialize some variables on CRIS CPU In-Reply-To: <65223c79fdfd7faf132275415cd9da9852c5bec3.1666257885.git.research_trasio@irq.a4lg.com> Message-ID: References: <65223c79fdfd7faf132275415cd9da9852c5bec3.1666257885.git.research_trasio@irq.a4lg.com> User-Agent: Alpine 2.20.16 (BSF 172 2016-09-29) MIME-Version: 1.0 Content-Type: text/plain; charset=US-ASCII X-Scanned-By: mailmunge 3.09 on 209.68.5.131 X-Spam-Status: No, score=-3.9 required=5.0 tests=BAYES_00,KAM_DMARC_STATUS,RCVD_IN_DNSWL_NONE,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 List-Id: On Thu, 20 Oct 2022, Tsukasa OI via Binutils wrote: > GCC / Clang generate a warning if a variable may be used uninitialized on > some cases (Clang: "-Wsometimes-uninitialized"). When the program is being > built by Clang with the default configuration, it causes a build failure > (unless "--disable-werror" is specified). > > Those error occur on sim/cris/semcrisv{10,32}f-switch.c but they are > CGEN-generated files. The real cause of this problem is in cpu/cris.cpu > which does not initialize certain variables. I'd say the problem is an artefact of CGEN code generation, as the conditions are exhaustive. In the generated code it's far from obvious though... > This commit ensures such variables are initialized to zero by default. > Note that this commit itself does not regenerate CRIS CPU related files > with CGEN because it still has several issues preventing regeneration. > They are to be fixed in the later commits. > > cpu/ChangeLog: > > * cris.cpu: Initialize condres, newval and tmpres variables. Ok with a comment saying something to the effect of "It's not obvious in generated code that all cases are covered in the conditional settings below, so initialize this to avoid compiler warnings" (and referring to the previous comment for all but the first). Thanks! brgds, H-P