------- Comment #2 from qiyao at gcc dot gnu dot org 2010-09-19 13:19 ------- In arm.c:arm_get_frame_offsets (void)
if (!crtl->tail_call_emit && arm_size_return_regs () <= 12 && (offsets->saved_regs_mask & (1 << 3)) == 0) { reg = 3; } In gcc-4.5, crtl->tail_call_emit is always false, so the condition is true. However, in gcc-4.6, crtl->tail_call_emit can be true. My stupid question is 'why can't we use r3 when we do tail call optimization?'. I read one sentence in comment, 'We try to avoid using the arg registers (r0 -r3) as they might be used to pass values in a tail call.'. Is it the answer to my question? If that is the answer, in oder to fix this bug, we may refine the condition to 'tail call insns are emitted, and r3 is used to pass values to tail call', like this, if (!(crtl->tail_call_emit && used_to_pass_values (3)) && ... && ...) Is this a correct fix? -- http://gcc.gnu.org/bugzilla/show_bug.cgi?id=45701