This is the mail archive of the gcc@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]

RFC: Update Intel386, x86-64 and IA MCU psABIs for passing/returning empty struct


Empty struct value is passed differently in C and C++ on Intel386 and x86-64.
Different compilers use different calling conventions on the same platform:

https://gcc.gnu.org/bugzilla/show_bug.cgi?id=60336

The same compiler behaves different on different platforms:

https://llvm.org/bugs/show_bug.cgi?id=26337

In some case, empty struct can't be passed in C++ at all:

https://gcc.gnu.org/bugzilla/show_bug.cgi?id=60336

I am proposing to update Intel386, x86-64 and IA MCU psABIs to specify
how to pass/return empty struct:

1. "collection".  A collection is a structure, union or C++ class.
2. "empty collection".  An empty collection is:
   a. A collection without member.  Or
   b. A collection with only empty collections.  Or
   c. An array of empty collections.
3. "empty record".  An empty record is Plain Old Data (POD) for the purpose
   of layout and
   a. A collection without member.  Or
   b. A collection with only empty collections.
4. No memory slot nor register should be used to pass or return an object of
empty collection.

The proposed Intel386, x86-64 and IA MCU psABIs are at

https://github.com/hjl-tools/x86-psABI/wiki/X86-psABI

Any comments?

Thanks.

-- 
H.J.


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