public inbox for gdb-prs@sourceware.org
help / color / mirror / Atom feed
* [Bug gdb/26064] New: inconsistent behaviors at -O2
@ 2020-05-30 2:58 yangyibiao at hust dot edu.cn
2020-05-30 2:58 ` [Bug gdb/26064] " yangyibiao at hust dot edu.cn
2021-01-13 13:02 ` yangyibiao at outlook dot com
0 siblings, 2 replies; 3+ messages in thread
From: yangyibiao at hust dot edu.cn @ 2020-05-30 2:58 UTC (permalink / raw)
To: gdb-prs
https://sourceware.org/bugzilla/show_bug.cgi?id=26064
Bug ID: 26064
Summary: inconsistent behaviors at -O2
Product: gdb
Version: HEAD
Status: UNCONFIRMED
Severity: normal
Priority: P2
Component: gdb
Assignee: unassigned at sourceware dot org
Reporter: yangyibiao at hust dot edu.cn
Target Milestone: ---
Consider test case:
...
$ cat small.c
#include <string.h>
volatile int one = 1;
int main() {
char a1[] = {(char)one, 2, 3, 4};
char a2[] = {1, (char)(2*one), 3, 4};
int res = memcmp (a1, a2, 5 + one);
return res;
}
...
When stepping using step Line 7 is not hit by gdb.
...
$ gcc -O2 -g small.c; gdb -q a.out
Reading symbols from a.out...
(gdb) b main
Breakpoint 1 at 0x401040: file small.c, line 6.
(gdb) r
Starting program: /home/yibiao/Debugger/a.out
Breakpoint 1, main () at small.c:6
6 char a1[] = {(char)one, 2, 3, 4};
(gdb) step
8 int res = memcmp (a1, a2, 5 + one);
(gdb)
...
When stepping using stepi, Line 7 is hit after Line 6 by gdb.
...
$ gcc -O2 -g small.c; gdb -q a.out
Reading symbols from a.out...
(gdb) b main
Breakpoint 1 at 0x401040: file small.c, line 6.
(gdb) si
The program is not being run.
(gdb) r
Starting program: /home/yibiao/Debugger/a.out
Breakpoint 1, main () at small.c:6
6 char a1[] = {(char)one, 2, 3, 4};
(gdb) si
0x0000000000401044 6 char a1[] = {(char)one, 2, 3, 4};
(gdb) si
0x000000000040104a 7 char a2[] = {1, (char)(2*one), 3, 4};
(gdb)
$ 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.
--
You are receiving this mail because:
You are on the CC list for the bug.
^ permalink raw reply [flat|nested] 3+ messages in thread
* [Bug gdb/26064] inconsistent behaviors at -O2
2020-05-30 2:58 [Bug gdb/26064] New: inconsistent behaviors at -O2 yangyibiao at hust dot edu.cn
@ 2020-05-30 2:58 ` yangyibiao at hust dot edu.cn
2021-01-13 13:02 ` yangyibiao at outlook dot com
1 sibling, 0 replies; 3+ messages in thread
From: yangyibiao at hust dot edu.cn @ 2020-05-30 2:58 UTC (permalink / raw)
To: gdb-prs
https://sourceware.org/bugzilla/show_bug.cgi?id=26064
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] 3+ messages in thread
* [Bug gdb/26064] inconsistent behaviors at -O2
2020-05-30 2:58 [Bug gdb/26064] New: inconsistent behaviors at -O2 yangyibiao at hust dot edu.cn
2020-05-30 2:58 ` [Bug gdb/26064] " yangyibiao at hust dot edu.cn
@ 2021-01-13 13:02 ` yangyibiao at outlook dot com
1 sibling, 0 replies; 3+ messages in thread
From: yangyibiao at outlook dot com @ 2021-01-13 13:02 UTC (permalink / raw)
To: gdb-prs
https://sourceware.org/bugzilla/show_bug.cgi?id=26064
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.
(gdb) maint info line-table
objfile: /home/yibiao/DeVIL/a.out ((struct objfile *) 0x557a30fda120)
compunit_symtab: ((struct compunit_symtab *) 0x557a30fd1400)
symtab: /home/yibiao/DeVIL/small.c ((struct symtab *) 0x557a30fd1480)
linetable: ((struct linetable *) 0x557a3101af00):
INDEX LINE ADDRESS IS-STMT
0 5 0x0000555555555080 Y
1 7 0x0000555555555088
2 6 0x000055555555508d
3 7 0x00005555555550a1
4 8 0x00005555555550a6
5 6 0x00005555555550ae
6 7 0x00005555555550b3 Y
7 8 0x00005555555550b3 Y
8 7 0x00005555555550b3
9 6 0x00005555555550b8
10 6 0x00005555555550bb
11 7 0x00005555555550c5
12 8 0x00005555555550cb
13 7 0x00005555555550d1
14 8 0x00005555555550d3
15 7 0x00005555555550d6
16 8 0x00005555555550da
17 9 0x00005555555550e2 Y
18 10 0x00005555555550e2
19 END 0x00005555555550fc Y
*** 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] 3+ messages in thread
end of thread, other threads:[~2021-01-13 13:02 UTC | newest]
Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2020-05-30 2:58 [Bug gdb/26064] New: inconsistent behaviors at -O2 yangyibiao at hust dot edu.cn
2020-05-30 2:58 ` [Bug gdb/26064] " yangyibiao at hust dot edu.cn
2021-01-13 13:02 ` 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).