From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: by sourceware.org (Postfix, from userid 48) id 299043851C17; Wed, 27 May 2020 22:45:51 +0000 (GMT) DKIM-Filter: OpenDKIM Filter v2.11.0 sourceware.org 299043851C17 From: "yangyibiao at hust dot edu.cn" To: gdb-prs@sourceware.org Subject: [Bug symtab/26059] New: inconsistent behaviors at -O0 Date: Wed, 27 May 2020 22:45:50 +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:45:51 -0000 https://sourceware.org/bugzilla/show_bug.cgi?id=3D26059 Bug ID: 26059 Summary: inconsistent behaviors at -O0 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 12575 --> https://sourceware.org/bugzilla/attachment.cgi?id=3D12575&action=3Ded= it a.out $ gcc --version gcc (GCC) 10.0.1 20200419 (experimental) Copyright (C) 2020 Free Software Foundation, Inc. This is free software; see the source for copying conditions. There is NO warranty; not even for MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. $ 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. $ cat small.c unsigned int b,d; static int c[1][2] =3D {{0, 1}}; int main() { for (; d<1; d++) for (; b<1; b++) c[b][d+1] =3D 0; return 0; } /***************************************************** When stepping using stepi, gdb first hit Line 6 and then hit Line 7 with st= epi for the first iteration of the second for loop. ******************************************************/ $ gcc -O0 -g small.c $ gdb -q a.out Reading symbols from a.out... (gdb) b 5 Breakpoint 1 at 0x401106: file small.c, line 5. (gdb) r Starting program: /home/yibiao/Debugger/a.out=20 Breakpoint 1, main () at small.c:5 5 for (; d<1; d++) (gdb) stepi 0x0000000000401154 5 for (; d<1; d++) (gdb) stepi 0x000000000040115a 5 for (; d<1; d++) (gdb) stepi 0x000000000040115c 5 for (; d<1; d++) (gdb) stepi 0x000000000040113b 6 for (; b<1; b++) (gdb) stepi 0x0000000000401141 6 for (; b<1; b++) (gdb) stepi 0x0000000000401143 6 for (; b<1; b++) (gdb) stepi 7 c[b][d+1] =3D 0; (gdb) /***************************************************** When stepping with step, gdb is first hit Line 7 and then hit Line 6. This is an inconsistent behaviors between stepi and step. *****************************************************/ $ gdb -q a.out Reading symbols from a.out... (gdb) b main Breakpoint 1 at 0x401106: file small.c, line 5. (gdb) r Starting program: /home/yibiao/Debugger/a.out=20 Breakpoint 1, main () at small.c:5 5 for (; d<1; d++) (gdb) step 7 c[b][d+1] =3D 0; (gdb)=20 6 for (; b<1; b++) (gdb)=20 Breakpoint 1, main () at small.c:6 6 for (; b<1; b++) (gdb) Note that, I submit this bug to gcc (https://gcc.gnu.org/bugzilla/show_bug.cgi?id=3D95360) and Tom de Vries com= mented that this bug should belongs to gdb. --=20 You are receiving this mail because: You are on the CC list for the bug.=