runtime: synchronize empty struct field handling
commitf38162977e2b7efaa75233a0cba2a30a2b7f5132
authormelonedo <funanzeng@gmail.com>
Mon, 19 Sep 2022 08:01:04 +0000 (19 16:01 +0800)
committerIan Lance Taylor <iant@golang.org>
Tue, 27 Sep 2022 16:28:39 +0000 (27 09:28 -0700)
treefe1805c24a4ce17d6d50af1ed31d23cb29ae935e
parent0b2706ac0e6d6b990d789325f9e081dfe4501f4f
runtime: synchronize empty struct field handling

In GCCGO and gollvm, the logic for allocating one byte for the last field is:
1. the last field has zero size
2. the struct itself does not have zero size
3. the last field is not blank
this commit adds the last two conditions to runtime.structToFFI.

For golang/go#55146

Reviewed-on: https://go-review.googlesource.com/c/gofrontend/+/431735
gcc/go/gofrontend/MERGE
libgo/go/runtime/ffi.go