public inbox for gcc-patches@gcc.gnu.org
 help / color / mirror / Atom feed
From: Jason Merrill <jason@redhat.com>
To: "H.J. Lu" <hjl.tools@gmail.com>
Cc: Joseph Myers <joseph@codesourcery.com>,
	       Ulrich Weigand <uweigand@de.ibm.com>,
	       GCC Patches <gcc-patches@gcc.gnu.org>,
	       Jakub Jelinek <jakub@redhat.com>,
	       Richard Biener <richard.guenther@gmail.com>,
	       Markus Trippelsdorf <markus@trippelsdorf.de>
Subject: Re: PING^1: [PATCH] Add TYPE_EMPTY_RECORD for C++ empty class
Date: Wed, 16 Mar 2016 14:33:00 -0000	[thread overview]
Message-ID: <56E96EAB.8040603@redhat.com> (raw)
In-Reply-To: <CAMe9rOr=0w5t_qda-E9SXy0cMVSrynU1gp3g6PuLNevihiu=KQ@mail.gmail.com>

On 03/16/2016 07:55 AM, H.J. Lu wrote:
> On Tue, Mar 15, 2016 at 7:51 PM, Jason Merrill <jason@redhat.com> 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 <joseph@codesourcery.com>
>>>> wrote:
>>>>>
>>>>> On Tue, 15 Mar 2016, H.J. Lu wrote:
>>>>>
>>>>>> On Tue, Mar 15, 2016 at 2:39 PM, Joseph Myers <joseph@codesourcery.com>
>>>>>> 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?

I would think so; it seems to follow clearly from this definition.  I 
have trouble imagining that anyone would ever pass an object containing 
a zero-length array by value, so it shouldn't matter much either way, 
but I consistency is good.

Jason

  reply	other threads:[~2016-03-16 14:33 UTC|newest]

Thread overview: 52+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2015-12-08 16:22 H.J. Lu
2015-12-09 14:05 ` Richard Biener
2015-12-09 18:53   ` H.J. Lu
2015-12-09 21:14     ` H.J. Lu
2015-12-09 21:31     ` Markus Trippelsdorf
2015-12-10 11:24       ` Richard Biener
2015-12-11 23:52         ` H.J. Lu
2015-12-12 14:51           ` Jason Merrill
2015-12-12 15:27             ` Jakub Jelinek
2015-12-12 16:45               ` H.J. Lu
2015-12-12 18:43               ` Marc Glisse
2015-12-14 20:16                 ` Jason Merrill
2015-12-14 20:39                   ` H.J. Lu
2015-12-14 20:44                     ` Jason Merrill
2015-12-14 22:08                       ` H.J. Lu
2016-01-26 19:27                         ` Jason Merrill
2016-01-26 19:52                           ` H.J. Lu
2016-01-26 20:23                             ` Marc Glisse
2016-01-26 20:26                               ` H.J. Lu
2016-01-26 20:44                                 ` Marc Glisse
2016-01-26 21:21                                   ` H.J. Lu
2016-01-26 21:40                                     ` Jakub Jelinek
2016-01-26 22:21                                       ` H.J. Lu
2016-01-27  8:10                                         ` Marc Glisse
2016-01-27  8:21                                           ` Jakub Jelinek
2016-01-27  9:03                                             ` Marc Glisse
2016-01-27 13:46                                               ` H.J. Lu
2016-01-27 15:39                                                 ` H.J. Lu
2016-03-01  1:02                                                   ` Jason Merrill
2016-03-01 22:44                                                     ` H.J. Lu
2016-03-02 16:25                                                       ` Ulrich Weigand
2016-03-02 17:34                                                         ` H.J. Lu
2016-03-15 15:35                                                           ` Jason Merrill
2016-03-15 16:00                                                             ` H.J. Lu
2016-03-15 19:32                                                               ` Jason Merrill
2016-03-16 12:38                                                                 ` H.J. Lu
2016-03-16 16:58                                                                   ` Jason Merrill
2016-03-16 17:02                                                                     ` H.J. Lu
2016-03-16 19:39                                                                       ` H.J. Lu
2016-03-16 19:43                                                                         ` Jason Merrill
2016-03-15 21:40                                                             ` Joseph Myers
2016-03-15 22:31                                                               ` H.J. Lu
2016-03-15 22:35                                                                 ` Joseph Myers
2016-03-16  0:23                                                                   ` H.J. Lu
2016-03-16  0:25                                                                     ` Joseph Myers
2016-03-16  2:17                                                                       ` H.J. Lu
2016-03-16  9:46                                                                         ` Bernhard Reutner-Fischer
2016-03-16 11:53                                                                           ` H.J. Lu
2016-03-16  2:51                                                                       ` Jason Merrill
2016-03-16 11:55                                                                         ` H.J. Lu
2016-03-16 14:33                                                                           ` Jason Merrill [this message]
2016-03-16 14:48                                                                             ` H.J. Lu

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=56E96EAB.8040603@redhat.com \
    --to=jason@redhat.com \
    --cc=gcc-patches@gcc.gnu.org \
    --cc=hjl.tools@gmail.com \
    --cc=jakub@redhat.com \
    --cc=joseph@codesourcery.com \
    --cc=markus@trippelsdorf.de \
    --cc=richard.guenther@gmail.com \
    --cc=uweigand@de.ibm.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).