public inbox for gcc-bugs@sourceware.org help / color / mirror / Atom feed
* [Bug debug/112565] New: Abnormal Jump in Execution using 'stepi' Command in GDB under O2 optimization @ 2023-11-16 11:51 iamanonymous.cs at gmail dot com 2023-11-16 11:55 ` [Bug debug/112565] " vries at gcc dot gnu.org ` (4 more replies) 0 siblings, 5 replies; 6+ messages in thread From: iamanonymous.cs at gmail dot com @ 2023-11-16 11:51 UTC (permalink / raw) To: gcc-bugs https://gcc.gnu.org/bugzilla/show_bug.cgi?id=112565 Bug ID: 112565 Summary: Abnormal Jump in Execution using 'stepi' Command in GDB under O2 optimization Product: gcc Version: 14.0 Status: UNCONFIRMED Severity: normal Priority: P3 Component: debug Assignee: unassigned at gcc dot gnu.org Reporter: iamanonymous.cs at gmail dot com Target Milestone: --- Bug reported initially reported: https://sourceware.org/bugzilla/show_bug.cgi?id=31070 Tom de Vries suggests that this issue may be attributed to a GCC optimization bug. $ cat small.c int glob_int_arr[100]; int *glob_ptr_int = glob_int_arr; void simple_global () { __builtin_prefetch (glob_int_arr, 0, 0); __builtin_prefetch (glob_ptr_int, 0, 0); } int main() { simple_global (); exit (0); } $ gcc -w -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: /root/devil/a.out Breakpoint 1, main () at small.c:6 6 __builtin_prefetch (glob_int_arr, 0, 0); (gdb) si 0x0000000000401044 in simple_global () at small.c:7 7 __builtin_prefetch (glob_ptr_int, 0, 0); (gdb) si 0x000000000040104b in main () at small.c:13 13 exit (0); (gdb) si 0x000000000040104d in simple_global () at small.c:6 6 __builtin_prefetch (glob_int_arr, 0, 0); (gdb) ================================================= When using the 'stepi' command in GDB, an abnormal jump in the execution occurs when reaching line 7 of the code. The execution unexpectedly jumps to line 13. $ gcc --version gcc (GCC) 14.0.0 20231116 (experimental) Copyright (C) 2023 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) 15.0.50.20231116-git Copyright (C) 2023 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. ^ permalink raw reply [flat|nested] 6+ messages in thread
* [Bug debug/112565] Abnormal Jump in Execution using 'stepi' Command in GDB under O2 optimization 2023-11-16 11:51 [Bug debug/112565] New: Abnormal Jump in Execution using 'stepi' Command in GDB under O2 optimization iamanonymous.cs at gmail dot com @ 2023-11-16 11:55 ` vries at gcc dot gnu.org 2023-11-16 12:00 ` iamanonymous.cs at gmail dot com ` (3 subsequent siblings) 4 siblings, 0 replies; 6+ messages in thread From: vries at gcc dot gnu.org @ 2023-11-16 11:55 UTC (permalink / raw) To: gcc-bugs https://gcc.gnu.org/bugzilla/show_bug.cgi?id=112565 --- Comment #1 from Tom de Vries <vries at gcc dot gnu.org> --- (In reply to Anonymous from comment #0) > Tom de Vries suggests that this issue may be attributed to a GCC > optimization bug. I do not. ^ permalink raw reply [flat|nested] 6+ messages in thread
* [Bug debug/112565] Abnormal Jump in Execution using 'stepi' Command in GDB under O2 optimization 2023-11-16 11:51 [Bug debug/112565] New: Abnormal Jump in Execution using 'stepi' Command in GDB under O2 optimization iamanonymous.cs at gmail dot com 2023-11-16 11:55 ` [Bug debug/112565] " vries at gcc dot gnu.org @ 2023-11-16 12:00 ` iamanonymous.cs at gmail dot com 2023-11-16 12:42 ` iamanonymous.cs at gmail dot com ` (2 subsequent siblings) 4 siblings, 0 replies; 6+ messages in thread From: iamanonymous.cs at gmail dot com @ 2023-11-16 12:00 UTC (permalink / raw) To: gcc-bugs https://gcc.gnu.org/bugzilla/show_bug.cgi?id=112565 --- Comment #2 from Anonymous <iamanonymous.cs at gmail dot com> --- (In reply to Tom de Vries from comment #1) > (In reply to Anonymous from comment #0) > > Tom de Vries suggests that this issue may be attributed to a GCC > > optimization bug. > > I do not. Thanks for the correction. I apologize for the misunderstanding. I didn't notice that you mentioned this behavior was expected. ^ permalink raw reply [flat|nested] 6+ messages in thread
* [Bug debug/112565] Abnormal Jump in Execution using 'stepi' Command in GDB under O2 optimization 2023-11-16 11:51 [Bug debug/112565] New: Abnormal Jump in Execution using 'stepi' Command in GDB under O2 optimization iamanonymous.cs at gmail dot com 2023-11-16 11:55 ` [Bug debug/112565] " vries at gcc dot gnu.org 2023-11-16 12:00 ` iamanonymous.cs at gmail dot com @ 2023-11-16 12:42 ` iamanonymous.cs at gmail dot com 2023-11-16 12:47 ` rguenth at gcc dot gnu.org 2023-11-16 14:26 ` iamanonymous.cs at gmail dot com 4 siblings, 0 replies; 6+ messages in thread From: iamanonymous.cs at gmail dot com @ 2023-11-16 12:42 UTC (permalink / raw) To: gcc-bugs https://gcc.gnu.org/bugzilla/show_bug.cgi?id=112565 --- Comment #3 from Anonymous <iamanonymous.cs at gmail dot com> --- However, I still feel that the current debugging process be somewhat misleading, and I am uncertain if there are any approaches to enhance the overall debugging experience. ^ permalink raw reply [flat|nested] 6+ messages in thread
* [Bug debug/112565] Abnormal Jump in Execution using 'stepi' Command in GDB under O2 optimization 2023-11-16 11:51 [Bug debug/112565] New: Abnormal Jump in Execution using 'stepi' Command in GDB under O2 optimization iamanonymous.cs at gmail dot com ` (2 preceding siblings ...) 2023-11-16 12:42 ` iamanonymous.cs at gmail dot com @ 2023-11-16 12:47 ` rguenth at gcc dot gnu.org 2023-11-16 14:26 ` iamanonymous.cs at gmail dot com 4 siblings, 0 replies; 6+ messages in thread From: rguenth at gcc dot gnu.org @ 2023-11-16 12:47 UTC (permalink / raw) To: gcc-bugs https://gcc.gnu.org/bugzilla/show_bug.cgi?id=112565 Richard Biener <rguenth at gcc dot gnu.org> changed: What |Removed |Added ---------------------------------------------------------------------------- Resolution|--- |INVALID Status|UNCONFIRMED |RESOLVED --- Comment #4 from Richard Biener <rguenth at gcc dot gnu.org> --- GCC can interleave instructions belonging to different source lines so that's what you see. Since you advance assembler instructions I don't see a way to "improve" things here when optimizing. ^ permalink raw reply [flat|nested] 6+ messages in thread
* [Bug debug/112565] Abnormal Jump in Execution using 'stepi' Command in GDB under O2 optimization 2023-11-16 11:51 [Bug debug/112565] New: Abnormal Jump in Execution using 'stepi' Command in GDB under O2 optimization iamanonymous.cs at gmail dot com ` (3 preceding siblings ...) 2023-11-16 12:47 ` rguenth at gcc dot gnu.org @ 2023-11-16 14:26 ` iamanonymous.cs at gmail dot com 4 siblings, 0 replies; 6+ messages in thread From: iamanonymous.cs at gmail dot com @ 2023-11-16 14:26 UTC (permalink / raw) To: gcc-bugs https://gcc.gnu.org/bugzilla/show_bug.cgi?id=112565 --- Comment #5 from Anonymous <iamanonymous.cs at gmail dot com> --- (In reply to Richard Biener from comment #4) > GCC can interleave instructions belonging to different source lines so > that's what you see. Since you advance assembler instructions I don't see a > way to > "improve" things here when optimizing. Got it. Thanks. ^ permalink raw reply [flat|nested] 6+ messages in thread
end of thread, other threads:[~2023-11-16 14:26 UTC | newest] Thread overview: 6+ messages (download: mbox.gz / follow: Atom feed) -- links below jump to the message on this page -- 2023-11-16 11:51 [Bug debug/112565] New: Abnormal Jump in Execution using 'stepi' Command in GDB under O2 optimization iamanonymous.cs at gmail dot com 2023-11-16 11:55 ` [Bug debug/112565] " vries at gcc dot gnu.org 2023-11-16 12:00 ` iamanonymous.cs at gmail dot com 2023-11-16 12:42 ` iamanonymous.cs at gmail dot com 2023-11-16 12:47 ` rguenth at gcc dot gnu.org 2023-11-16 14:26 ` iamanonymous.cs at gmail 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).