public inbox for gdb-prs@sourceware.org
help / color / mirror / Atom feed
* [Bug testsuite/29161] New: [gcc-12] FAIL: gdb.opt/clobbered-registers-O2.exp: print operand0
@ 2022-05-20  9:35 vries at gcc dot gnu.org
  2022-05-20  9:38 ` [Bug testsuite/29161] " vries at gcc dot gnu.org
                   ` (2 more replies)
  0 siblings, 3 replies; 4+ messages in thread
From: vries at gcc dot gnu.org @ 2022-05-20  9:35 UTC (permalink / raw)
  To: gdb-prs

https://sourceware.org/bugzilla/show_bug.cgi?id=29161

            Bug ID: 29161
           Summary: [gcc-12] FAIL: gdb.opt/clobbered-registers-O2.exp:
                    print operand0
           Product: gdb
           Version: HEAD
            Status: NEW
          Severity: normal
          Priority: P2
         Component: testsuite
          Assignee: unassigned at sourceware dot org
          Reporter: vries at gcc dot gnu.org
  Target Milestone: ---

On openSUSE Tumbleweed, with gcc-12, I run into:
...
FAIL: gdb.opt/clobbered-registers-O2.exp: print operand0
FAIL: gdb.opt/clobbered-registers-O2.exp: print operand1
...
while these pass when using gcc-11 instead.

Also fail with gcc-12 when forcing dwarf-4 as in gcc-11.

In more detail, with gcc-11:
...
print operand0^M
$1 = (unsigned int *) 0x7fffffffcd50^M
(gdb) print *operand0^M
$2 = 13^M
(gdb) PASS: gdb.opt/clobbered-registers-O2.exp: print operand0
print operand1^M
$3 = (unsigned int *) 0x7fffffffcd54^M
(gdb) print *operand1^M
$4 = 14^M
(gdb) PASS: gdb.opt/clobbered-registers-O2.exp: print operand1
...
and with gcc-12:
...
print operand0^M
$1 = (unsigned int *) 0x7fffffffcfb0^M
(gdb) print *operand0^M
$2 = 4198725^M
(gdb) FAIL: gdb.opt/clobbered-registers-O2.exp: print operand0
print operand1^M
$3 = (unsigned int *) 0x7fffffffcfb4^M
(gdb) print *operand1^M
$4 = 0^M
(gdb) FAIL: gdb.opt/clobbered-registers-O2.exp: print operand1
...

A significant difference between the two execs is that the assignments to x and
y are optimized away: gcc-11:
...
0000000000401020 <main>:
  401020:       48 83 ec 10             sub    $0x10,%rsp
  401024:       48 8d 74 24 0c          lea    0xc(%rsp),%rsi
  401029:       48 8d 7c 24 08          lea    0x8(%rsp),%rdi
  40102e:       c7 44 24 08 0d 00 00    movl   $0xd,0x8(%rsp)
  401035:       00 
  401036:       c7 44 24 0c 0e 00 00    movl   $0xe,0xc(%rsp)
  40103d:       00 
  40103e:       e8 1d 01 00 00          call   401160 <gen_movsd>
  401043:       48 83 c4 10             add    $0x10,%rsp
  401047:       c3                      ret    
...
vs gcc-12:
...
0000000000401020 <main>:
  401020:       48 8d 74 24 fc          lea    -0x4(%rsp),%rsi
  401025:       48 8d 7c 24 f8          lea    -0x8(%rsp),%rdi
  40102a:       e9 11 01 00 00          jmp    401140 <gen_movsd>
...

Another significant difference is the application of sibcall optimization, but
switching that off doesn't fix the fail.

This fixes the FAIL for me:
...
diff --git a/gdb/testsuite/gdb.opt/clobbered-registers-O2.c
b/gdb/testsuite/gdb.opt/cl
obbered-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;
...

-- 
You are receiving this mail because:
You are on the CC list for the bug.

^ permalink raw reply	[flat|nested] 4+ messages in thread

end of thread, other threads:[~2022-05-24 20:43 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2022-05-20  9:35 [Bug testsuite/29161] New: [gcc-12] FAIL: gdb.opt/clobbered-registers-O2.exp: print operand0 vries at gcc dot gnu.org
2022-05-20  9:38 ` [Bug testsuite/29161] " vries at gcc dot gnu.org
2022-05-24 14:40 ` vries at gcc dot gnu.org
2022-05-24 20:43 ` vries at gcc dot gnu.org

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).