This is the mail archive of the
gcc-patches@gcc.gnu.org
mailing list for the GCC project.
Re: PING^1: [PATCH] Add TYPE_EMPTY_RECORD for C++ empty class
- From: Jakub Jelinek <jakub at redhat dot com>
- To: Jason Merrill <jason at redhat dot com>
- Cc: "H.J. Lu" <hjl dot tools at gmail dot com>, Richard Biener <richard dot guenther at gmail dot com>, Markus Trippelsdorf <markus at trippelsdorf dot de>, GCC Patches <gcc-patches at gcc dot gnu dot org>
- Date: Sat, 12 Dec 2015 16:27:31 +0100
- Subject: Re: PING^1: [PATCH] Add TYPE_EMPTY_RECORD for C++ empty class
- Authentication-results: sourceware.org; auth=none
- References: <CAMe9rOo9pcJ_75FmUSs62PBf-neM=+-ftqOD=ffpOm7p6Grx7Q at mail dot gmail dot com> <CAFiYyc2Qx3DfTraZjUCR0Ha17++SNU-4d5SjGMSWn1hZWKK4uA at mail dot gmail dot com> <CAMe9rOrMC4XjhFW-a1TdGD2SJo7=yhtGX8r=KxLEyit1WLwpog at mail dot gmail dot com> <20151209213118 dot GC317 at x4> <CAFiYyc2jYtFdiLRdviOX3M-_BV=h_SnyTMm01jKA4ZAVnbaa6w at mail dot gmail dot com> <CAMe9rOrogonLyyMwY8BGs-ue52kO8jKiOH9q1KHxWiicWCFHkA at mail dot gmail dot com> <566C346B dot 8030601 at redhat dot com>
- Reply-to: Jakub Jelinek <jakub at redhat dot com>
On Sat, Dec 12, 2015 at 09:51:23AM -0500, Jason Merrill wrote:
> On 12/11/2015 06:52 PM, H.J. Lu wrote:
> >On Thu, Dec 10, 2015 at 3:24 AM, Richard Biener
> ><richard.guenther@gmail.com> wrote:
> >>On Wed, Dec 9, 2015 at 10:31 PM, Markus Trippelsdorf
> >><markus@trippelsdorf.de> wrote:
> >>>On 2015.12.09 at 10:53 -0800, H.J. Lu wrote:
> >>>>
> >>>>Empty C++ class is a corner case which isn't covered in psABI nor C++ ABI.
> >>>>There is no mention of "empty record" in GCC documentation. But there are
> >>>>plenty of "empty class" in gcc/cp. This change affects all targets. C++ ABI
> >>>>should specify how it should be passed.
> >>>
> >>>There is a C++ ABI mailinglist, where you could discuss this issue:
> >>>http://sourcerytools.com/cgi-bin/mailman/listinfo/cxx-abi-dev
> >>
> >>Yep. As long as the ABI doesn't state how to pass those I'd rather _not_ change
> >>GCCs way.
> >
> >It is agreed that GCC is wrong on this:
> >
> >http://sourcerytools.com/pipermail/cxx-abi-dev/2015-December/002876.html
>
> Yes, I think this is just a (nasty) bug on some GCC targets.
Well, the argument in that thread is weird, because C and C++ empty structs
are different, so it isn't surprising they are passed differently.
C++ makes those sizeof == 1, while C has them sizeof == 0.
So I rather think clang should change rather than GCC.
Jakub