* Joseph Myers:

> On Fri, 21 Oct 2022, Florian Weimer via Gcc wrote:
>
>> Is this really possible?  For function pointers, it's an ABI change.
>> int (*) () and int (*) (void) have different calling conventions on some
>> ABIs (e.g., powerpc64le-linux-gnu).  The ABI difference goes away once
>> the callees are rebuilt, and I think such rebuilt callees are compatible
>> with either calling convention.
>
> The semantics of int (*) (void) are a refinement of those of pre-C2x 
> int (*) (): any non-variadic function whose argument types are unchanged 
> by the default argument promotions can be called through an int (*) () 
> pointer, but only functions with no arguments can be called through an 
> int (*) (void) pointer.

Pre-C2x powerpc64le-linux-gnu, a call through int (*) () with no
arguments still sets up a parameter save area, while a call through int
(*) (void) does not.  With C2x, neither will set up a parameter save
area.  Hopefully, the current rs6000 backend already uses the parameter
save area just for, well, saving parameters, and not for general-purpose
spilling.  In this case, there won't be any ABI problems from the C2x
change for powerpc64le.

(Sorry that I keep bringing this up, it's confusing to me, and I once
spent quite some time tracking down a stack corruption because glibc's
open implementation assumed a parameter save area that the caller did
not provide.)

Thanks,
Florian

Reply via email to