On Wed, Apr 06, 2011 at 12:43:11AM +0200, Jakub Jelinek wrote: > On the pr48466.c testcase below on i?86 -m32 -g -O0 we generate wrong debug > info for some of the variables in main. This was caused by PR36977 fix, > crtl->stack_realign_tried is true, but fde->drap_reg is INVALID_REGNUM, > but frame_pointer_rtx is being eliminated to hard_frame_pointer_regnum > rather than stack_pointer_regnum. Fixed by using hfp instead of sp > in that case, the patch is also adding a testcase from PR36977 to make sure > it doesn't regress.
FYI, the difference in between pr36977.c and pr48466.c is that in the latter emit_call_1 to foo (which returns a struct) sets crtl->need_drap, and while we don't create any stack realignment in the end because it wasn't needed, it affected register elimination: ep->can_eliminate = ep->can_eliminate_previous = (targetm.can_eliminate (ep->from, ep->to) && ! (ep->to == STACK_POINTER_REGNUM && frame_pointer_needed && (! SUPPORTS_STACK_ALIGNMENT || ! stack_realign_fp))); Jakub