This is the mail archive of the
gcc-patches@gcc.gnu.org
mailing list for the GCC project.
Re: RFC: C++ PATCH to adjust empty class parameter passing ABI
- From: Jakub Jelinek <jakub at redhat dot com>
- To: Ramana Radhakrishnan <ramana dot gcc at googlemail dot com>
- Cc: Kyrill Tkachov <kyrylo dot tkachov at foss dot arm dot com>, Christophe Lyon <christophe dot lyon at linaro dot org>, Jason Merrill <jason at redhat dot com>, gcc-patches List <gcc-patches at gcc dot gnu dot org>, Jonathan Wakely <jwakely at redhat dot com>, "H.J. Lu" <hjl dot tools at gmail dot com>, Richard Earnshaw <Richard dot Earnshaw at arm dot com>
- Date: Thu, 14 Apr 2016 13:25:59 +0200
- Subject: Re: RFC: C++ PATCH to adjust empty class parameter passing ABI
- Authentication-results: sourceware.org; auth=none
- References: <20160413153217 dot GT19207 at tucnak dot redhat dot com> <570E6B9B dot 1010200 at redhat dot com> <570E99E6 dot 3040603 at redhat dot com> <20160413191830 dot GW19207 at tucnak dot redhat dot com> <570EA818 dot 9030807 at redhat dot com> <CAKdteOa-ztXv9+fE5Jd26XXeKZnwAwPgcgA7PCPH6xaS0_vNiA at mail dot gmail dot com> <570F65BD dot 6030204 at foss dot arm dot com> <CAJA7tRZ-cHhufp+-tYz8gqmKvkkKZ-MRnDBgz7auhnthw8dDEQ at mail dot gmail dot com> <20160414103616 dot GB19207 at tucnak dot redhat dot com> <CAJA7tRb33ZeuXk9G0JMa5RhjcXF8T2dSbiqf0Ap9iSOh_Tir3w at mail dot gmail dot com>
- Reply-to: Jakub Jelinek <jakub at redhat dot com>
On Thu, Apr 14, 2016 at 12:19:26PM +0100, Ramana Radhakrishnan wrote:
> Is this a valid example for what you have in mind ?
>
> struct baz
> {
> char a[1024];
> };
> struct foo : baz
> {
> };
>
> int bar (struct foo b, int x)
No, I meant say:
struct A {};
struct B { A a[1024]; };
int bar (struct B b, int c)
{
return c;
}
int baz (int a, int b, int c, int d, int e, int f, int g, struct B h, int i)
{
return g + i;
}
Strangely, we warn about this with -Wabi=9 even on x86_64-linux on both
testcases, while only on baz it actually changes code generation.
> if so, that would get treated as though it is just a 1 byte quantity
> for C++. as per current behaviour by both gcc and llvm for aarch64.
>
> > How do you pass empty C structures?
>
> I don't think we do anything special for empty C structures which IIRC
> means they don't take a slot.
I think the intent of the C++ changes was to make them roughly match (at
least for the empty classes where C++ says sizeof (...) == 1 while
C says sizeof (...) == 0) what C does.
Jakub