------- Comment #4 from kazu at gcc dot gnu dot org 2006-05-19 19:36 ------- Infinite recursion is going on in CSE. Here is what happens.
At cse.c:4278 in fold_rtx, we have (gdb) call debug_rtx(x) (plus:SI (reg/v/f:SI 60 [ first ]) (const_int 4 [0x4])) (gdb) call debug_rtx(y) (plus:SI (reg/v/f:SI 60 [ first ]) (mem/s/j:SI (plus:SI (reg/v/f:SI 59 [ cur ]) (const_int 4 [0x4])) [0 <variable>.offset_next+0 S4 A32])) (gdb) Here we call fold_rtx (XEXP (y, 1), 0), where XEXP (y, 1) is (mem/s/j:SI (plus:SI (reg/v/f:SI 59 [ cur ]) (const_int 4 [0x4])) [0 <variable>.offset_next+0 S4 A32]) fold_rtx delegates all processing of MEMs to fold_rtx_mem, so fold_rtx_mem gets (mem/s/j:SI (plus:SI (reg/v/f:SI 59 [ cur ]) (const_int 4 [0x4])) [0 <variable>.offset_next+0 S4 A32]) fold_rtx_mem in turn calls fold_rtx with the address inside the MEM, which is: (plus:SI (reg/v/f:SI 59 [ cur ]) (const_int 4 [0x4])) [0 <variable>.offset_next+0 S4 A32]) fold_rtx later calls lookup_as_function on (reg/v/f:SI 59 [ cur ]), which returns (plus:SI (reg/v/f:SI 60 [ first ]) (mem/s/j:SI (plus:SI (reg/v/f:SI 60 [ first ]) (const_int 4 [0x4])) [0 <variable>.offset_next+0 S4 A32])) which is the same as what we started with. -- http://gcc.gnu.org/bugzilla/show_bug.cgi?id=27616