From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: by sourceware.org (Postfix, from userid 2205) id 8A4133857BA0; Tue, 24 May 2022 20:41:50 +0000 (GMT) DKIM-Filter: OpenDKIM Filter v2.11.0 sourceware.org 8A4133857BA0 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable From: Tom de Vries To: gdb-cvs@sourceware.org Subject: [binutils-gdb] [gdb/testsuite] Fix gdb.opt/clobbered-registers-O2.exp with gcc-12 X-Act-Checkin: binutils-gdb X-Git-Author: Tom de Vries X-Git-Refname: refs/heads/master X-Git-Oldrev: 387e00f3b3e6ea3719f144d7090c1a242174be4d X-Git-Newrev: a0ae328a266d2b01ff640be9277e01592b08971a Message-Id: <20220524204150.8A4133857BA0@sourceware.org> Date: Tue, 24 May 2022 20:41:50 +0000 (GMT) X-BeenThere: gdb-cvs@sourceware.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: Gdb-cvs mailing list List-Unsubscribe: , List-Archive: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 24 May 2022 20:41:50 -0000 https://sourceware.org/git/gitweb.cgi?p=3Dbinutils-gdb.git;h=3Da0ae328a266d= 2b01ff640be9277e01592b08971a commit a0ae328a266d2b01ff640be9277e01592b08971a Author: Tom de Vries Date: Tue May 24 22:41:45 2022 +0200 [gdb/testsuite] Fix gdb.opt/clobbered-registers-O2.exp with gcc-12 =20 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 =3D (unsigned int *) 0x7fffffffd070^M (gdb) print *operand0^M $2 =3D 4195541^M (gdb) FAIL: gdb.opt/clobbered-registers-O2.exp: print operand0 ... =20 The problem is that starting gcc-12, the assignments to x and y in main= are optimized away: ... int main(void) { unsigned x, y; =20 x =3D 13; y =3D 14; return (int)gen_movsd (&x, &y); ... =20 Fix this by making x and y volatile. =20 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. =20 Tested on x86_64-linux. =20 Bug: https://sourceware.org/bugzilla/show_bug.cgi?id=3D29161 Diff: --- 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) =20 int main(void) { - unsigned x, y; + volatile unsigned x, y; =20 x =3D 13; y =3D 14;