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

Franz Sirl Franz.Sirl-kernel@lauterbach.com
Fri Apr 30 22:47:00 GMT 1999


At 18:58 19.04.99 , Gary Thomas wrote:

>On 19-Apr-99 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 and varargs_save_area_size is fortunately fixed on PPC/SYSV,
>> so the calculation is easy. Changing this calculation in rs6000.c produced
>> a correct prologue, but the varargs were still accessed at the wrong
>> offsets by the macros in va-ppc.h, cause they are based on
>> __builtin_args_info(4), which still returned wrong offsets. That's why I
>> introduce the new __builtin_varargs_save_area(), which looked to me like
>> the least intrusive method to solve this and thus has a good chance to be
>> accepted for egcs-1.2. Might be even useful on other targets.
>>
>
>This sort of problem is exactly why these macros (like __builtin_args_info(4))
>are there.  Is it not possible to fix the macro?  Or are you worried about
>code that's already been compiled?

>Yes, but the problem with __builtin_args_info(4) is that it accesses 
>cum->varargs_offset, which should have been setup in 
>rs6000.c/setup_incoming_varargs(). This function uses 
>current_function_outgoing_args_size (via RS6000_VARARGS_OFFSET) which is 
>not yet known at this early stage of function scanning and so always 
>cum->varargs_offset is 0 when evaluated by __builtin_args_info(4).

If you show me a good way to modify the insns generated by 
__builtin_args_info(4) at a later stage, I'll implement that too, but I 
think such a solution would be much more complicated and code-intrusive.

Franz.





More information about the Gcc-patches mailing list