From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from simark.ca by simark.ca with LMTP id 9plSG6HmjGJqEwgAWB0awg (envelope-from ) for ; Tue, 24 May 2022 10:07:29 -0400 Received: by simark.ca (Postfix, from userid 112) id 5D86A1E220; Tue, 24 May 2022 10:07:29 -0400 (EDT) Authentication-Results: simark.ca; dkim=pass (1024-bit key; secure) header.d=sourceware.org header.i=@sourceware.org header.a=rsa-sha256 header.s=default header.b=lSmL3YrS; dkim-atps=neutral X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on simark.ca X-Spam-Level: X-Spam-Status: No, score=-2.0 required=5.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,MAILING_LIST_MULTI,RDNS_DYNAMIC,URIBL_BLOCKED autolearn=ham autolearn_force=no version=3.4.6 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 EB0911E00D for ; Tue, 24 May 2022 10:07:28 -0400 (EDT) Received: from server2.sourceware.org (localhost [IPv6:::1]) by sourceware.org (Postfix) with ESMTP id 9362838293DE for ; Tue, 24 May 2022 14:07:28 +0000 (GMT) DKIM-Filter: OpenDKIM Filter v2.11.0 sourceware.org 9362838293DE DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=sourceware.org; s=default; t=1653401248; bh=f64IyujnFUWe4c9PtZwBTkTSXIbqY39KE9goQBKApnY=; h=Date:To:Subject:List-Id:List-Unsubscribe:List-Archive:List-Post: List-Help:List-Subscribe:From:Reply-To:From; b=lSmL3YrSt+3ZdhzTvS0vEABIAvbUbjmuHAh5Dq3+PBRjtJ8Q/j2cuCbVQAR4zSTLr TmRs9GvNGNBJUXsoeumRlVWg9R16LcxcL88UXBn0mjL5zYqiUzs0ZSZFjLWRUAfg28 NJVokOgWWXqleCYE3bVb5sU6Ga7unC9jTjacoLwU= Received: from smtp-out2.suse.de (smtp-out2.suse.de [195.135.220.29]) by sourceware.org (Postfix) with ESMTPS id 7DEE23857340 for ; Tue, 24 May 2022 14:07:08 +0000 (GMT) DMARC-Filter: OpenDMARC Filter v1.4.1 sourceware.org 7DEE23857340 Received: from imap2.suse-dmz.suse.de (imap2.suse-dmz.suse.de [192.168.254.74]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature ECDSA (P-521) server-digest SHA512) (No client certificate requested) by smtp-out2.suse.de (Postfix) with ESMTPS id B444F1F90F for ; Tue, 24 May 2022 14:07:07 +0000 (UTC) Received: from imap2.suse-dmz.suse.de (imap2.suse-dmz.suse.de [192.168.254.74]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature ECDSA (P-521) server-digest SHA512) (No client certificate requested) by imap2.suse-dmz.suse.de (Postfix) with ESMTPS id 962AB13ADF for ; Tue, 24 May 2022 14:07:07 +0000 (UTC) Received: from dovecot-director2.suse.de ([192.168.254.65]) by imap2.suse-dmz.suse.de with ESMTPSA id KtaCI4vmjGLtEQAAMHmgww (envelope-from ) for ; Tue, 24 May 2022 14:07:07 +0000 Date: Tue, 24 May 2022 16:07:06 +0200 To: gdb-patches@sourceware.org Subject: [PATCH][gdb/testsuite] Fix gdb.opt/clobbered-registers-O2.exp with gcc-12 Message-ID: <20220524140704.GA23593@delia.home> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline User-Agent: Mutt/1.10.1 (2018-07-13) 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: Tom de Vries via Gdb-patches Reply-To: Tom de Vries Errors-To: gdb-patches-bounces+public-inbox=simark.ca@sourceware.org Sender: "Gdb-patches" Hi, When running test-case gdb.opt/clobbered-registers-O2.exp with gcc-12, I run into: ... (gdb) PASS: gdb.opt/clobbered-registers-O2.exp: backtracing print operand0^M $1 = (unsigned int *) 0x7fffffffd070^M (gdb) print *operand0^M $2 = 4195541^M (gdb) FAIL: gdb.opt/clobbered-registers-O2.exp: print operand0 ... The problem is that starting gcc-12, the assignments to x and y in main are optimized away: ... int main(void) { unsigned x, y; x = 13; y = 14; return (int)gen_movsd (&x, &y); ... Fix this by making x and y volatile. Note that the test-case intends to check the handling of debug info for optimized code in function gen_movsd, so inhibiting optimization in main doesn't interfere with that. Tested on x86_64-linux. Bug: https://sourceware.org/bugzilla/show_bug.cgi?id=29161 Any comments? Thanks, - Tom [gdb/testsuite] Fix gdb.opt/clobbered-registers-O2.exp with gcc-12 --- gdb/testsuite/gdb.opt/clobbered-registers-O2.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/gdb/testsuite/gdb.opt/clobbered-registers-O2.c b/gdb/testsuite/gdb.opt/clobbered-registers-O2.c index 7776024eb90..83cf2267d1e 100644 --- a/gdb/testsuite/gdb.opt/clobbered-registers-O2.c +++ b/gdb/testsuite/gdb.opt/clobbered-registers-O2.c @@ -33,7 +33,7 @@ gen_movsd (unsigned * operand0, unsigned * operand1) int main(void) { - unsigned x, y; + volatile unsigned x, y; x = 13; y = 14;