public inbox for gcc-bugs@sourceware.org
help / color / mirror / Atom feed
* [Bug debug/95360] New: inconsistent behaviors at -O0
@ 2020-05-27 10:05 yangyibiao at hust dot edu.cn
  2020-05-27 10:05 ` [Bug debug/95360] " yangyibiao at hust dot edu.cn
                   ` (8 more replies)
  0 siblings, 9 replies; 10+ messages in thread
From: yangyibiao at hust dot edu.cn @ 2020-05-27 10:05 UTC (permalink / raw)
  To: gcc-bugs

https://gcc.gnu.org/bugzilla/show_bug.cgi?id=95360

            Bug ID: 95360
           Summary: inconsistent behaviors at -O0
           Product: gcc
           Version: 10.0
            Status: UNCONFIRMED
          Severity: normal
          Priority: P3
         Component: debug
          Assignee: unassigned at gcc dot gnu.org
          Reporter: yangyibiao at hust dot edu.cn
  Target Milestone: ---

$ 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 <http://gnu.org/licenses/gpl.html>
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] = {{0, 1}};

int main() {
  for (; d<1; d++)
    for (; b<1; b++)
      c[b][d+1] = 0;

  return 0;
}


$ 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 

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] = 0;
(gdb)


/*****************************************************
As showed, Line 6 is hit first and then hit Line 7 with stepi.
However, when using 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 

Breakpoint 1, main () at small.c:5
5         for (; d<1; d++)
(gdb) step
7             c[b][d+1] = 0;
(gdb) 
6           for (; b<1; b++)
(gdb) 


Breakpoint 1, main () at small.c:6
6           for (; b<1; b++)
(gdb)

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

end of thread, other threads:[~2021-07-18 22:20 UTC | newest]

Thread overview: 10+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2020-05-27 10:05 [Bug debug/95360] New: inconsistent behaviors at -O0 yangyibiao at hust dot edu.cn
2020-05-27 10:05 ` [Bug debug/95360] " yangyibiao at hust dot edu.cn
2020-05-27 10:44 ` redi at gcc dot gnu.org
2020-05-27 12:03 ` marxin at gcc dot gnu.org
2020-05-27 12:35 ` vries at gcc dot gnu.org
2020-05-27 13:07 ` vries at gcc dot gnu.org
2020-05-27 13:25 ` yangyibiao at hust dot edu.cn
2020-05-27 13:33 ` yangyibiao at hust dot edu.cn
2020-05-27 15:53 ` vries at gcc dot gnu.org
2021-07-18 22:20 ` pinskia 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).