This is the mail archive of the gcc@gcc.gnu.org mailing list for the GCC project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

Re: function arguments offset computation with -fomit-frame-pointer


> > Anyway IIRC the correct solution is to use ELIMINATE_REGS rather
> > than INITIAL_FRAME_POINTER_OFFSET.  (Hmm, that'd indicate the
> > problem being related to eliminating the argument pointer in
> > favor of the stack pointer and missing an offset between fp and
> > ap or something.)
>
>Actually, there must be something _very_ bad going on here. Frame
>handling for the ColdFire is a little more complicated because there
>are no pre-decrement and post-increment addressing modes in movem.
>The size of saved registers has to be added to the stack pointer within
>the same instruction that increments it to create the frame (either link
>or lea/add/move).
>
>I've double-checked the way I compute the frame size in the prolog,
>epologue and and in initial_frame_pointer_offset(). I added debug
>statements to print the computed sizes in the generated assembly.
>Everything appears to be fine for several cases I examined, so I was
>quite confident about it.
>
> However, there must be still a bug somewhere because a Linux kernel
>compiled with -fomit-frame-pointer crashes with bus errors in a place
>I cannot reach with the debugger. I don't have strong evidence on this,
>but I believe one function gets its parameters from the wrong sp offset.


Check to see if you have the following change:

[peter@baradas gcc]$ cvs diff -r1.1 reload1.c
Index: reload1.c
===================================================================
RCS file: /home/cvs/xgcc/gcc-3.3/gcc/reload1.c,v
retrieving revision 1.1
retrieving revision 1.2
diff -r1.1 -r1.2
2839c2839,2844
<       elimination_effects (SET_SRC (x), 0);
---
>       /* In the case where we're pushing a parameter, use the memory
>          mode of the move, not VOIDmode. */
>       mem_mode = GET_MODE (SET_DEST (x));
>       elimination_effects (SET_SRC (x),
>                            push_operand (SET_DEST (x), mem_mode) ?
>                            mem_mode : 0);
[peter@baradas gcc]$ 


I found this necessary to fix a problem with -fomit-frame-pointer on
ColdFire where gcc had an off-by-four bug when accessing parameters.
See:

http://gcc.gnu.org/ml/gcc/2002-04/msg00177.html

to see where I got the fix, or:

http://gcc.gnu.org/ml/gcc/2002-04/msg00009.html

for the root of the discussion thread.

-- 
Peter Barada                             Peter.Barada@motorola.com
Wizard                                   781-852-2768 (direct)
WaveMark Solutions(A Motorola Company)   781-270-0193 (fax)


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]