From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from simark.ca by simark.ca with LMTP id EECGJEUfh2GOYAAAWB0awg (envelope-from ) for ; Sat, 06 Nov 2021 20:35:17 -0400 Received: by simark.ca (Postfix, from userid 112) id 93C021F0C1; Sat, 6 Nov 2021 20:35:17 -0400 (EDT) X-Spam-Checker-Version: SpamAssassin 3.4.2 (2018-09-13) on simark.ca X-Spam-Level: X-Spam-Status: No, score=-1.1 required=5.0 tests=DKIM_SIGNED,DKIM_VALID, DKIM_VALID_AU,MAILING_LIST_MULTI,URIBL_BLOCKED,WEIRD_QUOTING autolearn=ham autolearn_force=no version=3.4.2 Received: from sourceware.org (server2.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 036AB1EE1A for ; Sat, 6 Nov 2021 20:35:17 -0400 (EDT) Received: from server2.sourceware.org (localhost [IPv6:::1]) by sourceware.org (Postfix) with ESMTP id 818AC3858406 for ; Sun, 7 Nov 2021 00:35:16 +0000 (GMT) DKIM-Filter: OpenDKIM Filter v2.11.0 sourceware.org 818AC3858406 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=sourceware.org; s=default; t=1636245316; bh=DjMulEYW0F2tAocenKegIWSEIQXyEYhNs96coHKtOjg=; h=To:Subject:Date:In-Reply-To:References:List-Id:List-Unsubscribe: List-Archive:List-Post:List-Help:List-Subscribe:From:Reply-To: From; b=QnB14/bzzidBceIxj1vt4qXKsJBAy8o6QcEm34zNU4fOArQhN4hY8x/rNriKVToHI FxcCOTzKeTUyV4P18kfrIqzr1vSLOV0ssGgGhgpg+GgsPSQIwCW5hCJYcabv0PHFK9 OHarRLKGKP/06VQPgy9BDVn6VriBYRIi+0nHggDo= Received: from smtp.gentoo.org (smtp.gentoo.org [IPv6:2001:470:ea4a:1:5054:ff:fec7:86e4]) by sourceware.org (Postfix) with ESMTP id 77CC63858406 for ; Sun, 7 Nov 2021 00:33:06 +0000 (GMT) DMARC-Filter: OpenDMARC Filter v1.4.1 sourceware.org 77CC63858406 Received: by smtp.gentoo.org (Postfix, from userid 559) id 086C634315E; Sun, 7 Nov 2021 00:33:05 +0000 (UTC) To: gdb-patches@sourceware.org Subject: [PATCH 5/6] sim: sh: fix uninitialized variable usage with pdmsb Date: Sat, 6 Nov 2021 20:32:53 -0400 Message-Id: <20211107003254.4298-5-vapier@gentoo.org> X-Mailer: git-send-email 2.33.0 In-Reply-To: <20211107003254.4298-1-vapier@gentoo.org> References: <20211107003254.4298-1-vapier@gentoo.org> MIME-Version: 1.0 Content-Transfer-Encoding: 8bit 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 Errors-To: gdb-patches-bounces+public-inbox=simark.ca@sourceware.org Sender: "Gdb-patches" This block of code relies on i to control which bits to test and how many times to run through the loop, but it never actually initialized it. There is another chunk of code that handles the pdmsb instruction that sets i to 16, so use that here too assuming it's correct. The programming manual suggests this is the right value too, but I am by no means a SuperH DSP expert. The tests are still passing though ... --- sim/sh/gencode.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/sim/sh/gencode.c b/sim/sh/gencode.c index 9ef8b4610be1..80eecfdf1d36 100644 --- a/sim/sh/gencode.c +++ b/sim/sh/gencode.c @@ -2363,7 +2363,7 @@ op ppi_tab[] = }, { "","", "(if cc) pdmsb Sy,Dz", "101111cc..yyzzzz", "unsigned Sy = DSP_R (y);", - "int i;", + "int i = 16;", "", "if (Sy < 0)", " Sy = ~Sy;", -- 2.33.0