[PATCH] RFC new builtin to fix PPC/SYSV varargs bug

Richard Henderson rth@cygnus.com
Tue Apr 20 01:07:00 GMT 1999


On Mon, Apr 19, 1999 at 03:20:51PM +0200, Franz Sirl wrote:
> My patch changes the offset calculation from being based on 
> frame_pointer_rtx+outgoing_args_size to 
> virtual_stack_vars_rtx-varargs_save_area_size. virtual_stack_vars_rtx 
> corresponds to the base of the "Local variable space" mentioned in the 
> diagram above ...

I don't see that this results in a different calculation.

According to INITIAL_ELIMINATION_OFFSETS, frame_pointer_rtx corresponds
to SP with A=0 in your diagram.  And RS6000_VARARGS_OFFSET does include
the six words before ... er, six words?

/* Size of the fixed area on the stack */
#define RS6000_SAVE_AREA (TARGET_32BIT ? 24 : 48)

Where is this in your picture?

>         SP----> +---------------------------------------+
>                 | back chain to caller                  | 0
>                 +---------------------------------------+
>                 | caller's saved LR                     | 4
>                 +---------------------------------------+
>                 | Parameter save area (P)               | 8
>                 +---------------------------------------+
>                 | Alloca space (A)                      | 8+P
>                 +---------------------------------------+
>                 | Varargs save area (V)                 | 8+P+A
>                 +---------------------------------------+
>                 | Local variable space (L)              | 8+P+A+V
>                 +---------------------------------------+
>                 | Float/int conversion temporary (X)    | 8+P+A+V+L
>                 +---------------------------------------+
>                 | saved CR (C)                          | 8+P+A+V+L+X
>                 +---------------------------------------+
>                 | Save area for GP registers (G)        | 8+P+A+V+L+X+C
>                 +---------------------------------------+
>                 | Save area for FP registers (F)        | 8+P+A+V+L+X+C+G
>                 +---------------------------------------+
>         old SP->| back chain to caller's caller         |
>                 +---------------------------------------+

> Hmm, actually the varargs save area might also be overwritten by operations 
> on alloca'ed memory.

If you get that address right, you'll not overwrite alloca memory,
since the FP is not affected by that, only SP.


r~


More information about the Gcc-patches mailing list