------- Comment #4 from dave dot korn dot cygwin at gmail dot com 2009-01-23 23:44 ------- The bug manifests itself as a crash on exit from main(); $eip is set to zero and we get a SEGV.
On entry to main(), the registers show: esp 0x22cc40 0x22cc40 ebp 0x22cca8 0x22cca8 Just before the epilogue at the end of main, we see: esp 0x22cc40 0x22cc40 ebp 0x22cc90 0x22cc90 (gdb) x/32xw 0x22cc40 0x22cc40: 0x0022cc5c 0x0040e7e0 0x00000000 0x004f0584 0x22cc50: 0x005005c2 0x32200060 0x0022cc78 0x00000000 0x22cc60: 0x00000000 0x100325b8 0x00000001 0x61010173 0x22cc70: 0x00000001 0x00407600 0x00407bd4 0x0022cc90 0x22cc80: 0x004010ec 0x0022cc40 0x00000000 0x610df2c7 0x22cc90: 0x100324fa 0x00000000 0x611021a0 0x0040546c 0x22cca0: 0x611021a0 0x0040546c 0x0022cd98 0x610060e8 0x22ccb0: 0x00000001 0x100324a0 0x10030090 0x60030000 (gdb) and so when we come to the ret instruction, ... (gdb) Breakpoint 2, 0x00401125 in main () at ./eh.C:11 11 } (gdb) info reg eax 0x0 0 ecx 0x22cb30 2280240 edx 0x0 0 ebx 0x0 0 esp 0x22cc94 0x22cc94 ebp 0x100324fa 0x100324fa esi 0x611021a0 1628447136 edi 0x40546c 4215916 eip 0x401125 0x401125 <main+181> eflags 0x202 [ IF ] cs 0x1b 27 ss 0x23 35 ds 0x23 35 es 0x23 35 fs 0x38 56 gs 0x0 0 (gdb) stepi 0x00000000 in ?? () Next comment will analyze how $ebp comes to have the wrong value. -- http://gcc.gnu.org/bugzilla/show_bug.cgi?id=38952