public inbox for gdb-cvs@sourceware.org
help / color / mirror / Atom feed
* [binutils-gdb] [gdb/testsuite] Fix gdb.opt/clobbered-registers-O2.exp with gcc-12
@ 2022-05-24 20:41 Tom de Vries
  0 siblings, 0 replies; only message in thread
From: Tom de Vries @ 2022-05-24 20:41 UTC (permalink / raw)
  To: gdb-cvs

https://sourceware.org/git/gitweb.cgi?p=binutils-gdb.git;h=a0ae328a266d2b01ff640be9277e01592b08971a

commit a0ae328a266d2b01ff640be9277e01592b08971a
Author: Tom de Vries <tdevries@suse.de>
Date:   Tue May 24 22:41:45 2022 +0200

    [gdb/testsuite] Fix gdb.opt/clobbered-registers-O2.exp with gcc-12
    
    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

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)
 
 int main(void)
 {
-  unsigned x, y;
+  volatile unsigned x, y;
 
   x = 13;
   y = 14;


^ permalink raw reply	[flat|nested] only message in thread

only message in thread, other threads:[~2022-05-24 20:41 UTC | newest]

Thread overview: (only message) (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2022-05-24 20:41 [binutils-gdb] [gdb/testsuite] Fix gdb.opt/clobbered-registers-O2.exp with gcc-12 Tom de Vries

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).