On Wed, 2023-05-24 at 14:04 +0800, Lulu Cheng wrote:
> An empty struct type that is not non-trivial for the purposes of calls
> will be treated as though it were the following C type:
> 
> struct {
>   char c;
> };
> 
> Before this patch was added, a structure parameter containing an empty 
> structure and
> less than three floating-point members was passed through one or two 
> floating-point
> registers, while nested empty structures are ignored. Which did not conform 
> to the
> calling convention.

No, it's a deliberate decision I've made in
https://gcc.gnu.org/r12-8294.  And we already agreed "the ABI needs to
be updated" when we applied r12-8294, but I've never improved my English
skill to revise the ABI myself :(.

We are also using the same "de-facto" ABI throwing away the empty struct
for Clang++ (https://reviews.llvm.org/D132285).  So we should update the
spec here, instead of changing every implementation.

The C++ standard treats the empty struct as size 1 for ensuring the
semantics of pointer comparison operations.  When we pass it through the
registers, there is no need to really consider the empty field because
there is no pointers to registers.

-- 
Xi Ruoyao <xry...@xry111.site>
School of Aerospace Science and Technology, Xidian University

Reply via email to