From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: 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 From: Tom de Vries 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-Spam-Status: No, score=-12.4 required=5.0 tests=BAYES_00, DKIM_SIGNED, DKIM_VALID, DKIM_VALID_AU, DKIM_VALID_EF, GIT_PATCH_0, KAM_NUMSUBJECT, SPF_HELO_NONE, 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.29 Precedence: list List-Id: Gdb-patches mailing list List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 24 May 2022 14:07:11 -0000 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;