From patchwork Tue Jan 9 01:13:35 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Mike Frysinger X-Patchwork-Id: 83575 Return-Path: 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 2CFCB3857BAA for ; Tue, 9 Jan 2024 01:14:08 +0000 (GMT) X-Original-To: gdb-patches@sourceware.org Delivered-To: gdb-patches@sourceware.org Received: from smtp.gentoo.org (mail.gentoo.org [IPv6:2001:470:ea4a:1:5054:ff:fec7:86e4]) by sourceware.org (Postfix) with ESMTP id D694B3858289 for ; Tue, 9 Jan 2024 01:13:37 +0000 (GMT) DMARC-Filter: OpenDMARC Filter v1.4.2 sourceware.org D694B3858289 Authentication-Results: sourceware.org; dmarc=pass (p=none dis=none) header.from=gentoo.org Authentication-Results: sourceware.org; spf=pass smtp.mailfrom=gentoo.org ARC-Filter: OpenARC Filter v1.0.0 sourceware.org D694B3858289 Authentication-Results: server2.sourceware.org; arc=none smtp.remote-ip=2001:470:ea4a:1:5054:ff:fec7:86e4 ARC-Seal: i=1; a=rsa-sha256; d=sourceware.org; s=key; t=1704762820; cv=none; b=fFlkq0Cnz2IAq2P3rcGlTVSzT4HdivAojAjfTIpr+xyrn2VybXUknJ52GvG3G3ud/wJ+yiPYNv/ikPTXu88RgCcdXWayBan9HscDcQiq0M5RfD8F6msK5f0f6ZGu2CUWSD3xetjZnQCJnkSjmF2C6B8ufp15qqK348IqwivXYAQ= ARC-Message-Signature: i=1; a=rsa-sha256; d=sourceware.org; s=key; t=1704762820; c=relaxed/simple; bh=boyIfoAYklQskupMHXLRxIFtMYjMbnkNpmcGf1vaIG4=; h=From:To:Subject:Date:Message-ID:MIME-Version; b=tUQOlTgOR1P2pKFSwDx1JIdL0LDVsZuKDYooLauwDl/whnSs8BcWO9Hh7JqP6e4f1jWFNy59pOKrtWRkpjwcQm9+6ty09N9axP3grzDVFT0WYZsXzLuY3F+Aim8OcgKAy/pV5dwKZcNtxh+A/jNUQqy+Yir0GyeDhiLIAiG8Tb0= ARC-Authentication-Results: i=1; server2.sourceware.org Received: by smtp.gentoo.org (Postfix, from userid 559) id 41BA93432B0; Tue, 9 Jan 2024 01:13:37 +0000 (UTC) From: Mike Frysinger To: gdb-patches@sourceware.org Subject: [PATCH] sim: ppc: workaround uninitialized variable compiler warnings Date: Mon, 8 Jan 2024 20:13:35 -0500 Message-ID: <20240109011335.3377-1-vapier@gentoo.org> X-Mailer: git-send-email 2.43.0 MIME-Version: 1.0 X-Spam-Status: No, score=-11.3 required=5.0 tests=BAYES_00, GIT_PATCH_0, JMQ_SPF_NEUTRAL, KAM_DMARC_STATUS, SPF_HELO_PASS, SPF_PASS, 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 X-BeenThere: gdb-patches@sourceware.org X-Mailman-Version: 2.1.30 Precedence: list List-Id: Gdb-patches mailing list List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: gdb-patches-bounces+patchwork=sourceware.org@sourceware.org Some compilers don't understand the semctl API and think it's an input argument even when it's used as an output, and then complains that it is being used uninitialized. Zero it out explicitly to workaround it. This adds some runtime overhead, but should be fairly minor as it's a small stack buffer, and shouldn't be that relevant relative to all the other logic in these functions. --- sim/ppc/hw_sem.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/sim/ppc/hw_sem.c b/sim/ppc/hw_sem.c index c43af3b1d9ed..9495b8591b92 100644 --- a/sim/ppc/hw_sem.c +++ b/sim/ppc/hw_sem.c @@ -111,7 +111,7 @@ hw_sem_init_data(device *me) hw_sem_device *sem = (hw_sem_device*)device_data(me); const device_unit *d; int status; - union semun help; + union semun help = {}; /* initialize the properties of the sem */ @@ -190,7 +190,7 @@ hw_sem_io_read_buffer(device *me, struct sembuf sb; int status; uint32_t u32; - union semun help; + union semun help = {}; /* do we need to worry about out of range addresses? */