public inbox for gcc-bugs@sourceware.org
help / color / mirror / Atom feed
* [Bug debug/95414] New: Wrong debug info for argc at -O2
@ 2020-05-29 12:24 yangyibiao at hust dot edu.cn
2022-11-09 2:50 ` [Bug debug/95414] " yangyibiao at nju dot edu.cn
2022-11-09 8:44 ` rguenth at gcc dot gnu.org
0 siblings, 2 replies; 3+ messages in thread
From: yangyibiao at hust dot edu.cn @ 2020-05-29 12:24 UTC (permalink / raw)
To: gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=95414
Bug ID: 95414
Summary: Wrong debug info for argc at -O2
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: ---
Created attachment 48633
--> https://gcc.gnu.org/bugzilla/attachment.cgi?id=48633&action=edit
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.
yibiao:~/Debugger$ 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
#include <stdio.h>
int main(int argc, char **argv) {
char buf[6];
char c[] = "abc";
sprintf(buf, (char *)c, 1);
return 0;
}
...
$ 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 5.
(gdb) r
Starting program: /home/yibiao/Debugger/a.out
Breakpoint 1, main (argc=1, argv=0x7fffffffdff8) at small.c:5
5 char c[] = "abc";
(gdb) info args argc
argc = 1
(gdb) step
6 sprintf(buf, (char *)c, 1);
(gdb) info args argc
argc = -8454
(gdb)
/**************************************
We can find that at line 5, the value of argc is 1. When stepping to line 6,
the value of argc is changed to -8454. When stepping with stepi, the value of
argc is correct.
^ permalink raw reply [flat|nested] 3+ messages in thread
* [Bug debug/95414] Wrong debug info for argc at -O2
2020-05-29 12:24 [Bug debug/95414] New: Wrong debug info for argc at -O2 yangyibiao at hust dot edu.cn
@ 2022-11-09 2:50 ` yangyibiao at nju dot edu.cn
2022-11-09 8:44 ` rguenth at gcc dot gnu.org
1 sibling, 0 replies; 3+ messages in thread
From: yangyibiao at nju dot edu.cn @ 2022-11-09 2:50 UTC (permalink / raw)
To: gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=95414
--- Comment #1 from Yibiao Yang <yangyibiao at nju dot edu.cn> ---
Hi, @Richard Biener
I updated gcc to the latest trunk version and found that this bug seems have
been fixed in the following trunk version.
$ gcc --version
gcc (GCC) 13.0.0 20221107 (experimental)
I was wondering whether this bug can be closed as fixed.
^ permalink raw reply [flat|nested] 3+ messages in thread
* [Bug debug/95414] Wrong debug info for argc at -O2
2020-05-29 12:24 [Bug debug/95414] New: Wrong debug info for argc at -O2 yangyibiao at hust dot edu.cn
2022-11-09 2:50 ` [Bug debug/95414] " yangyibiao at nju dot edu.cn
@ 2022-11-09 8:44 ` rguenth at gcc dot gnu.org
1 sibling, 0 replies; 3+ messages in thread
From: rguenth at gcc dot gnu.org @ 2022-11-09 8:44 UTC (permalink / raw)
To: gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=95414
Richard Biener <rguenth at gcc dot gnu.org> changed:
What |Removed |Added
----------------------------------------------------------------------------
Resolution|--- |FIXED
Status|UNCONFIRMED |RESOLVED
Known to fail| |10.3.0, 11.2.0
Known to work| |10.4.0, 11.3.0, 12.1.0
--- Comment #2 from Richard Biener <rguenth at gcc dot gnu.org> ---
Even GCC 10.4.0 now prints <optimized out>, so fixed (possibly a dup).
^ permalink raw reply [flat|nested] 3+ messages in thread
end of thread, other threads:[~2022-11-09 8:44 UTC | newest]
Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2020-05-29 12:24 [Bug debug/95414] New: Wrong debug info for argc at -O2 yangyibiao at hust dot edu.cn
2022-11-09 2:50 ` [Bug debug/95414] " yangyibiao at nju dot edu.cn
2022-11-09 8:44 ` rguenth 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).