This is the mail archive of the
mailing list for the GCC project.
Re: [RFC] PR61300 K&R incoming args
- From: Alan Modra <amodra at gmail dot com>
- To: Florian Weimer <fweimer at redhat dot com>
- Cc: gcc at gcc dot gnu dot org
- Date: Sat, 31 May 2014 16:26:25 +0930
- Subject: Re: [RFC] PR61300 K&R incoming args
- Authentication-results: sourceware.org; auth=none
- References: <20140526073809 dot GA6679 at bubble dot grove dot modra dot org> <5388DA76 dot 3060103 at redhat dot com>
On Fri, May 30, 2014 at 09:22:30PM +0200, Florian Weimer wrote:
> On 05/26/2014 09:38 AM, Alan Modra wrote:
> >Background: The ELFv2 ABI requires a parameter save area only when
> >stack is actually used to pass parameters, and since varargs are
> >passed on the stack, unprototyped calls must pass both on the stack
> >and in registers. OK, easy you say, !prototype_p(fun) means a
> >parameter save area is needed. However, a prototype might not be in
> >scope when compiling an old K&R style C function body, but this does
> >*not* mean a parameter save area has necesasrily been allocated.
> It's fine to change ABI when compiling an old-style function
> definition for which a prototype exists (relative to the
> non-prototype case). It happens on i386, too.
That might be so, but when compiling the function body you must assume
the worst case, whatever that might be, at the call site. For K&R
code, our error was to assume the call was unprototyped (which
paradoxically is the best case) when compiling the function body.
Australia Development Lab, IBM