From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 42884 invoked by alias); 16 Mar 2016 11:55:37 -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 42863 invoked by uid 89); 16 Mar 2016 11:55:36 -0000 Authentication-Results: sourceware.org; auth=none X-Virus-Found: No X-Spam-SWARE-Status: No, score=-2.3 required=5.0 tests=AWL,BAYES_00,FREEMAIL_FROM,RCVD_IN_DNSWL_LOW,SPF_PASS autolearn=ham version=3.3.2 spammy= X-HELO: mail-qk0-f169.google.com Received: from mail-qk0-f169.google.com (HELO mail-qk0-f169.google.com) (209.85.220.169) by sourceware.org (qpsmtpd/0.93/v0.84-503-g423c35a) with (AES128-GCM-SHA256 encrypted) ESMTPS; Wed, 16 Mar 2016 11:55:25 +0000 Received: by mail-qk0-f169.google.com with SMTP id o6so19517750qkc.2 for ; Wed, 16 Mar 2016 04:55:25 -0700 (PDT) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20130820; h=x-gm-message-state:mime-version:in-reply-to:references:date :message-id:subject:from:to:cc; bh=GGoRd3k4mgjM8oZTK66D9QIrRQAVr4DYEPCwMOQGhD8=; b=cCwxPrhH/rJdKj0I1OyXXuaSIOrjKWt6JnZvMnuEJ3r69eTbrTnqs4XC0lB3Wc3PGF sonZZ3UYJO2bOHNc+yzYlrdsqiEa5qHncLnWCfmlJgLmBI7QPMlVnB+sDll+NnPw++NH JmajQdKifpebjZL+9fHiESkUHOu+PDk7EjvIv0qiqnPTTc3HZF82H2llkREp3ss+Z0EJ emL4T6f7gWcxDVQffTELUx8x1z9ezV7IZycrJUA31EgFB8p55NuIavylUZEchq9lTawF MncL4Vwl2pai9u9l8Fac23NvDzHqhG2TRrQBvIsfnNRexGJc/AJNCnUdoa6CqAz/sobp hP3Q== X-Gm-Message-State: AD7BkJIbTt7AUfxsE1+35DAAzcIV4qX8EMMNw7PfffnB8mkuT4vHmjWwOW5hm1QUsmQDNuLk0kDiv59llnegeA== MIME-Version: 1.0 X-Received: by 10.55.76.15 with SMTP id z15mr4533006qka.32.1458129323821; Wed, 16 Mar 2016 04:55:23 -0700 (PDT) Received: by 10.55.15.199 with HTTP; Wed, 16 Mar 2016 04:55:23 -0700 (PDT) In-Reply-To: <56E8CA16.2040206@redhat.com> References: <20160302162538.66068C88E@oc7340732750.ibm.com> <56E82BC4.7070401@redhat.com> <56E8CA16.2040206@redhat.com> Date: Wed, 16 Mar 2016 11:55:00 -0000 Message-ID: Subject: Re: PING^1: [PATCH] Add TYPE_EMPTY_RECORD for C++ empty class From: "H.J. Lu" To: Jason Merrill Cc: Joseph Myers , Ulrich Weigand , GCC Patches , Jakub Jelinek , Richard Biener , Markus Trippelsdorf Content-Type: text/plain; charset=UTF-8 X-IsSubscribed: yes X-SW-Source: 2016-03/txt/msg00904.txt.bz2 On Tue, Mar 15, 2016 at 7:51 PM, Jason Merrill wrote: > On 03/15/2016 08:25 PM, Joseph Myers wrote: >> >> On Tue, 15 Mar 2016, H.J. Lu wrote: >> >>> On Tue, Mar 15, 2016 at 3:34 PM, Joseph Myers >>> wrote: >>>> >>>> On Tue, 15 Mar 2016, H.J. Lu wrote: >>>> >>>>> On Tue, Mar 15, 2016 at 2:39 PM, Joseph Myers >>>>> wrote: >>>>>> >>>>>> I'm not sure if the zero-size arrays (a GNU extension) are considered >>>>>> to >>>>>> make a struct non-empty, but in any case I think the tests should >>>>>> cover >>>>>> such arrays as elements of structs. >>>>> >>>>> >>>>> There are couple tests for structs with members of array >>>>> of empty types. testsuite/g++.dg/abi/empty14.h has >>>> >>>> >>>> My concern is the other way round - structs with elements such as >>>> "int a[0];", an array [0] of a nonempty type. My reading of the >>>> subobject >>>> definition is that such an array should not cause the struct to be >>>> considered nonempty (it doesn't result in any int subobjects). >>> >>> >>> This is a test for struct with zero-size array, which isn't treated >>> as empty type. C++ and C are compatible in its passing. >> >> >> Where is the current definition of empty types you're proposing for use in >> GCC? Is the behavior of this case clear from that definition? > > > "An empty type is a type where it and all of its subobjects (recursively) > are of structure, union, or array type. No memory slot nor register should > be used to pass or return an object of empty type." > > It seems to me that such a struct should be considered an empty type under > this definition, since a zero-length array has no subobjects. > Since zero-size array is GCC extension, we can change it. Do we want to change its passing for C? -- H.J.