This is the mail archive of the gcc-patches@gcc.gnu.org mailing list for the GCC project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

Re: RFC: C++ PATCH to adjust empty class parameter passing ABI


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


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]