public inbox for gdb-prs@sourceware.org help / color / mirror / Atom feed
From: "yangyibiao at outlook dot com" <sourceware-bugzilla@sourceware.org> To: gdb-prs@sourceware.org Subject: [Bug gdb/29220] New: GDB prints wrong value at -O2 Date: Thu, 02 Jun 2022 01:27:29 +0000 [thread overview] Message-ID: <bug-29220-4717@http.sourceware.org/bugzilla/> (raw) https://sourceware.org/bugzilla/show_bug.cgi?id=29220 Bug ID: 29220 Summary: GDB prints wrong value at -O2 Product: gdb Version: HEAD Status: UNCONFIRMED Severity: normal Priority: P2 Component: gdb Assignee: unassigned at sourceware dot org Reporter: yangyibiao at outlook dot com Target Milestone: --- $ gdb --version GNU gdb (GDB) 13.0.50.20220531-git $ gcc --version gcc (GCC) 13.0.0 20220530 (experimental) $ cat -n small.c 1 void foo(int *a) 2 { 3 (*a)++; 4 } 5 6 int main () 7 { 8 int a = 0; 9 foo (&a); 10 return 0; 11 } $ 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 10. (gdb) r Starting program: /root/DeVIL/a.out Breakpoint 1, main () at small.c:10 10 return 0; (gdb) info locals a = 0 (gdb) ### The expected value is "a = 1". However, gdb prints "a = 0". I know that this function is optimized out. I was wondering that a better solution for this is that gdb report the value of a is optmized out as well. -- You are receiving this mail because: You are on the CC list for the bug.
next reply other threads:[~2022-06-02 1:27 UTC|newest] Thread overview: 3+ messages / expand[flat|nested] mbox.gz Atom feed top 2022-06-02 1:27 yangyibiao at outlook dot com [this message] 2022-06-02 16:46 ` [Bug gdb/29220] " tromey at sourceware dot org 2022-06-05 17:53 ` tromey at sourceware dot org
Reply instructions: You may reply publicly to this message via plain-text email using any one of the following methods: * Save the following mbox file, import it into your mail client, and reply-to-all from there: mbox Avoid top-posting and favor interleaved quoting: https://en.wikipedia.org/wiki/Posting_style#Interleaved_style * Reply using the --to, --cc, and --in-reply-to switches of git-send-email(1): git send-email \ --in-reply-to=bug-29220-4717@http.sourceware.org/bugzilla/ \ --to=sourceware-bugzilla@sourceware.org \ --cc=gdb-prs@sourceware.org \ /path/to/YOUR_REPLY https://kernel.org/pub/software/scm/git/docs/git-send-email.html * If your mail client supports setting the In-Reply-To header via mailto: links, try the mailto: linkBe sure your reply has a Subject: header at the top and a blank line before the message body.
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).