With gdb 7.1 / gcc 4.5.0 I noticed that unrolled loops have very poor debugging information. The body cannot be single stepped, but a "next" in gdb jumps over the whole iteration space.
For example: main() { int i; for (i = 0; i < 10; i++) printf("%d\n",i ); } compiled with -O3 -g (which results in auto unrolling) gives: (gdb) b main Breakpoint 1 at 0x400520: file tloop2.c, line 2. (gdb) r Starting program: /home2/andi/tsrc/tloop2 Breakpoint 1, main () at tloop2.c:2 2 { (gdb) n 5 printf("%d\n",i ); (gdb) n 0 1 2 3 4 5 6 7 8 6 } (gdb) Note the single next stepped over the complete loop execution. I would have expected next to only execute one iteration. Is this a problem of the loop unroller not describing the unrolled loop to the debugger? -- Summary: bad Product: gcc Version: 4.5.0 Status: UNCONFIRMED Severity: normal Priority: P3 Component: debug AssignedTo: unassigned at gcc dot gnu dot org ReportedBy: andi-gcc at firstfloor dot org GCC host triplet: x86_64-linux GCC target triplet: x86_64-linux http://gcc.gnu.org/bugzilla/show_bug.cgi?id=44113