From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: by sourceware.org (Postfix, from userid 48) id C98F9383F868; Wed, 27 May 2020 22:01:55 +0000 (GMT) DKIM-Filter: OpenDKIM Filter v2.11.0 sourceware.org C98F9383F868 From: "yangyibiao at hust dot edu.cn" To: gdb-prs@sourceware.org Subject: [Bug symtab/26058] New: inconsistent behaviors at -O2 Date: Wed, 27 May 2020 22:01:55 +0000 X-Bugzilla-Reason: CC X-Bugzilla-Type: new X-Bugzilla-Watch-Reason: None X-Bugzilla-Product: gdb X-Bugzilla-Component: symtab X-Bugzilla-Version: HEAD X-Bugzilla-Keywords: X-Bugzilla-Severity: normal X-Bugzilla-Who: yangyibiao at hust dot edu.cn X-Bugzilla-Status: UNCONFIRMED X-Bugzilla-Resolution: X-Bugzilla-Priority: P2 X-Bugzilla-Assigned-To: unassigned at sourceware dot org X-Bugzilla-Target-Milestone: --- X-Bugzilla-Flags: X-Bugzilla-Changed-Fields: bug_id short_desc product version bug_status bug_severity priority component assigned_to reporter target_milestone attachments.created Message-ID: Content-Type: text/plain; charset="UTF-8" Content-Transfer-Encoding: quoted-printable X-Bugzilla-URL: http://sourceware.org/bugzilla/ Auto-Submitted: auto-generated MIME-Version: 1.0 X-BeenThere: gdb-prs@sourceware.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: Gdb-prs mailing list List-Unsubscribe: , List-Archive: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 27 May 2020 22:01:55 -0000 https://sourceware.org/bugzilla/show_bug.cgi?id=3D26058 Bug ID: 26058 Summary: inconsistent behaviors at -O2 Product: gdb Version: HEAD Status: UNCONFIRMED Severity: normal Priority: P2 Component: symtab Assignee: unassigned at sourceware dot org Reporter: yangyibiao at hust dot edu.cn Target Milestone: --- Created attachment 12574 --> https://sourceware.org/bugzilla/attachment.cgi?id=3D12574&action=3Ded= it a.out $ gdb --version GNU gdb (GDB) 10.0.50.20200517-git Copyright (C) 2020 Free Software Foundation, Inc. License GPLv3+: GNU GPL version 3 or later This is free software: you are free to change and redistribute it. There is NO WARRANTY, to the extent permitted by law. Consider test-case: ... $ cat small.c __attribute__((noinline)) void g(int x) { asm volatile ("" : "+r" (x)); } __attribute__((noinline)) int f(int a, int b, int d) { int r =3D -1; b +=3D d; if (d =3D=3D a) r =3D b - d; g (b); return r; } int main() { int l; asm ("" : "=3Dr" (l) : "0" (0)); f (l + 0, l + 1, l + 4); return 0; } ... When stepping through the program by using "step", line 11 is skipping over= .=20 ... $ gcc -O2 -g small.c; gdb -q a.out Reading symbols from a.out... (gdb) b main Breakpoint 1 at 0x401020: file small.c, line 18. (gdb) r Starting program: /home/yibiao/Debugger/a.out=20 Breakpoint 1, main () at small.c:18 18 asm ("" : "=3Dr" (l) : "0" (0)); (gdb) step 19 f (l + 0, l + 1, l + 4); (gdb) step f (a=3Da@entry=3D0, b=3Db@entry=3D1, d=3Dd@entry=3D4) at small.c:9 9 b +=3D d; (gdb) step 10 if (d =3D=3D a) (gdb) step 12 g (b); (gdb)=20 ... When stepping through the program by using "stepi", line 11 is hit by gdb a= fter line 9.=20 ... $ gcc -O2 -g small.c; gdb -q a.out Reading symbols from a.out... (gdb) b main Breakpoint 1 at 0x401020: file small.c, line 18. (gdb) r Starting program: /home/yibiao/Debugger/a.out=20 Breakpoint 1, main () at small.c:18 18 asm ("" : "=3Dr" (l) : "0" (0)); (gdb) stepi 19 f (l + 0, l + 1, l + 4); (gdb) stepi 0x0000000000401025 19 f (l + 0, l + 1, l + 4); (gdb) stepi 0x0000000000401028 19 f (l + 0, l + 1, l + 4); (gdb) stepi f (a=3Da@entry=3D0, b=3Db@entry=3D1, d=3Dd@entry=3D4) at small.c:9 9 b +=3D d; (gdb) stepi 0x0000000000401133 11 r =3D b - d; (gdb) --=20 You are receiving this mail because: You are on the CC list for the bug.=