public inbox for gdb-prs@sourceware.org
help / color / mirror / Atom feed
* [Bug symtab/26058] New: inconsistent behaviors at -O2
@ 2020-05-27 22:01 yangyibiao at hust dot edu.cn
  2020-05-29  0:06 ` [Bug symtab/26058] inconsistent Inconsistent order of execution " yangyibiao at hust dot edu.cn
                   ` (3 more replies)
  0 siblings, 4 replies; 5+ messages in thread
From: yangyibiao at hust dot edu.cn @ 2020-05-27 22:01 UTC (permalink / raw)
  To: gdb-prs

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

            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=12574&action=edit
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 <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.

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 = -1;
  b += d;
  if (d == a)
    r = b - d;
  g (b);
  return r;
}

int main() {
  int l;
  asm ("" : "=r" (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. 
...
$ 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 

Breakpoint 1, main () at small.c:18
18        asm ("" : "=r" (l) : "0" (0));
(gdb) step
19        f (l + 0, l + 1, l + 4);
(gdb) step
f (a=a@entry=0, b=b@entry=1, d=d@entry=4) at small.c:9
9         b += d;
(gdb) step
10        if (d == a)
(gdb) step
12        g (b);
(gdb) 


...

When stepping through the program by using "stepi", line 11 is hit by gdb after
line 9. 
...

$ 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 

Breakpoint 1, main () at small.c:18
18        asm ("" : "=r" (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=a@entry=0, b=b@entry=1, d=d@entry=4) at small.c:9
9         b += d;
(gdb) stepi
0x0000000000401133      11          r = b - d;
(gdb)

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

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

* [Bug symtab/26058] inconsistent Inconsistent order of execution at -O2
  2020-05-27 22:01 [Bug symtab/26058] New: inconsistent behaviors at -O2 yangyibiao at hust dot edu.cn
@ 2020-05-29  0:06 ` yangyibiao at hust dot edu.cn
  2020-05-29  6:37 ` [Bug symtab/26058] " yangyibiao at hust dot edu.cn
                   ` (2 subsequent siblings)
  3 siblings, 0 replies; 5+ messages in thread
From: yangyibiao at hust dot edu.cn @ 2020-05-29  0:06 UTC (permalink / raw)
  To: gdb-prs

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

Yibiao Yang <yangyibiao at hust dot edu.cn> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
            Summary|inconsistent behaviors at   |inconsistent Inconsistent
                   |-O2                         |order of execution at -O2

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

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

* [Bug symtab/26058] Inconsistent order of execution at -O2
  2020-05-27 22:01 [Bug symtab/26058] New: inconsistent behaviors at -O2 yangyibiao at hust dot edu.cn
  2020-05-29  0:06 ` [Bug symtab/26058] inconsistent Inconsistent order of execution " yangyibiao at hust dot edu.cn
@ 2020-05-29  6:37 ` yangyibiao at hust dot edu.cn
  2020-05-30  2:54 ` yangyibiao at hust dot edu.cn
  2021-01-13 12:23 ` yangyibiao at outlook dot com
  3 siblings, 0 replies; 5+ messages in thread
From: yangyibiao at hust dot edu.cn @ 2020-05-29  6:37 UTC (permalink / raw)
  To: gdb-prs

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

Yibiao Yang <yangyibiao at hust dot edu.cn> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
            Summary|inconsistent Inconsistent   |Inconsistent order of
                   |order of execution at -O2   |execution at -O2

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

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

* [Bug symtab/26058] Inconsistent order of execution at -O2
  2020-05-27 22:01 [Bug symtab/26058] New: inconsistent behaviors at -O2 yangyibiao at hust dot edu.cn
  2020-05-29  0:06 ` [Bug symtab/26058] inconsistent Inconsistent order of execution " yangyibiao at hust dot edu.cn
  2020-05-29  6:37 ` [Bug symtab/26058] " yangyibiao at hust dot edu.cn
@ 2020-05-30  2:54 ` yangyibiao at hust dot edu.cn
  2021-01-13 12:23 ` yangyibiao at outlook dot com
  3 siblings, 0 replies; 5+ messages in thread
From: yangyibiao at hust dot edu.cn @ 2020-05-30  2:54 UTC (permalink / raw)
  To: gdb-prs

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

Yibiao Yang <yangyibiao at hust dot edu.cn> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
                 CC|                            |rguenth at gcc dot gnu.org

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

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

* [Bug symtab/26058] Inconsistent order of execution at -O2
  2020-05-27 22:01 [Bug symtab/26058] New: inconsistent behaviors at -O2 yangyibiao at hust dot edu.cn
                   ` (2 preceding siblings ...)
  2020-05-30  2:54 ` yangyibiao at hust dot edu.cn
@ 2021-01-13 12:23 ` yangyibiao at outlook dot com
  3 siblings, 0 replies; 5+ messages in thread
From: yangyibiao at outlook dot com @ 2021-01-13 12:23 UTC (permalink / raw)
  To: gdb-prs

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

Yibiao Yang <yangyibiao at outlook dot com> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
         Resolution|---                         |DUPLICATE
             Status|UNCONFIRMED                 |RESOLVED

--- Comment #1 from Yibiao Yang <yangyibiao at outlook dot com> ---
Gdb does not support location views. This is all known behaviour.

*** This bug has been marked as a duplicate of bug 25507 ***

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

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

end of thread, other threads:[~2021-01-13 12:23 UTC | newest]

Thread overview: 5+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2020-05-27 22:01 [Bug symtab/26058] New: inconsistent behaviors at -O2 yangyibiao at hust dot edu.cn
2020-05-29  0:06 ` [Bug symtab/26058] inconsistent Inconsistent order of execution " yangyibiao at hust dot edu.cn
2020-05-29  6:37 ` [Bug symtab/26058] " yangyibiao at hust dot edu.cn
2020-05-30  2:54 ` yangyibiao at hust dot edu.cn
2021-01-13 12:23 ` yangyibiao at outlook dot com

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