From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 65472 invoked by alias); 12 Dec 2015 16:45:28 -0000 Mailing-List: contact gcc-patches-help@gcc.gnu.org; run by ezmlm Precedence: bulk List-Id: List-Archive: List-Post: List-Help: Sender: gcc-patches-owner@gcc.gnu.org Received: (qmail 65460 invoked by uid 89); 12 Dec 2015 16:45:27 -0000 Authentication-Results: sourceware.org; auth=none X-Virus-Found: No X-Spam-SWARE-Status: No, score=-1.6 required=5.0 tests=AWL,BAYES_00,FREEMAIL_FROM,RCVD_IN_DNSWL_LOW,SPF_PASS autolearn=ham version=3.3.2 X-HELO: mail-ob0-f177.google.com Received: from mail-ob0-f177.google.com (HELO mail-ob0-f177.google.com) (209.85.214.177) by sourceware.org (qpsmtpd/0.93/v0.84-503-g423c35a) with (AES128-GCM-SHA256 encrypted) ESMTPS; Sat, 12 Dec 2015 16:45:25 +0000 Received: by obbsd4 with SMTP id sd4so54859014obb.0 for ; Sat, 12 Dec 2015 08:45:23 -0800 (PST) MIME-Version: 1.0 X-Received: by 10.60.93.170 with SMTP id cv10mr18587527oeb.38.1449938723633; Sat, 12 Dec 2015 08:45:23 -0800 (PST) Received: by 10.76.77.99 with HTTP; Sat, 12 Dec 2015 08:45:23 -0800 (PST) In-Reply-To: <20151212152731.GB18720@tucnak.redhat.com> References: <20151209213118.GC317@x4> <566C346B.8030601@redhat.com> <20151212152731.GB18720@tucnak.redhat.com> Date: Sat, 12 Dec 2015 16:45:00 -0000 Message-ID: Subject: Re: PING^1: [PATCH] Add TYPE_EMPTY_RECORD for C++ empty class From: "H.J. Lu" To: Jakub Jelinek Cc: Jason Merrill , Richard Biener , Markus Trippelsdorf , GCC Patches Content-Type: text/plain; charset=UTF-8 X-IsSubscribed: yes X-SW-Source: 2015-12/txt/msg01330.txt.bz2 On Sat, Dec 12, 2015 at 7:27 AM, Jakub Jelinek wrote: > 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 >> > wrote: >> >>On Wed, Dec 9, 2015 at 10:31 PM, Markus Trippelsdorf >> >> 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. > But according to x86-64 psABI, sizeof == 1 should be passed in register, not on stack. This leads to weird GCC bugs like: https://gcc.gnu.org/bugzilla/show_bug.cgi?id=67239 -- H.J.