public inbox for gcc-patches@gcc.gnu.org
 help / color / mirror / Atom feed
From: Qing Zhao <qing.zhao@oracle.com>
To: Jason Merrill <jason@redhat.com>
Cc: Joseph Myers <josmyers@redhat.com>,
	Richard Biener <richard.guenther@gmail.com>,
	Siddhesh Poyarekar <siddhesh@gotplt.org>,
	"uecker@tugraz.at" <uecker@tugraz.at>,
	Kees Cook <keescook@chromium.org>,
	"gcc-patches@gcc.gnu.org" <gcc-patches@gcc.gnu.org>
Subject: Re: [PATCH v3 1/4] Allow flexible array members in unions and alone in structures [PR53548]
Date: Tue, 30 Apr 2024 21:53:12 +0000	[thread overview]
Message-ID: <A27F1F3B-C705-4DE5-B493-CE84D7A95220@oracle.com> (raw)
In-Reply-To: <f5fdb8c3-4571-42ac-8ed4-0a6febc2eb78@redhat.com>



> On Apr 30, 2024, at 15:52, Jason Merrill <jason@redhat.com> wrote:
> 
> On 4/30/24 14:49, Qing Zhao wrote:
>>> On Apr 30, 2024, at 15:45, Qing Zhao <qing.zhao@oracle.com> wrote:
>>> 
>>> 
>>> 
>>>>>  gcc/doc/extend.texi | 34 ++++++++++++++++++++++++++++++++++
>>>>>  1 file changed, 34 insertions(+)
>>>>> diff --git a/gcc/doc/extend.texi b/gcc/doc/extend.texi
>>>>> index 7b54a241a7bf..cba98c8aadd7 100644
>>>>> --- a/gcc/doc/extend.texi
>>>>> +++ b/gcc/doc/extend.texi
>>>>> @@ -42,6 +42,8 @@ extensions, accepted by GCC in C90 mode and in C++.
>>>>>  * Named Address Spaces::Named address spaces.
>>>>>  * Zero Length::         Zero-length arrays.
>>>>>  * Empty Structures::    Structures with no members.
>>>>> +* Flexible Array Members in Unions::  Unions with Flexible Array Members.
>>>>> +* Flexible Array Members alone in Structures::  Structures with only Flexible Array Members.
>>>>>  * Variable Length::     Arrays whose length is computed at run time.
>>>>>  * Variadic Macros::     Macros with a variable number of arguments.
>>>>>  * Escaped Newlines::    Slightly looser rules for escaped newlines.
>>>>> @@ -1873,6 +1875,38 @@ The structure has size zero.  In C++, empty structures are part
>>>>>  of the language.  G++ treats empty structures as if they had a single
>>>>>  member of type @code{char}.
>>>>>  +@node Flexible Array Members in Unions
>>>>> +@section Unions with Flexible Array Members
>>>>> +@cindex unions with flexible array members
>>>>> +@cindex unions with FAMs
>>>>> +
>>>>> +GCC permits a C99 flexible array member (FAM) to be in a union:
>>>>> +
>>>>> +@smallexample
>>>>> +union with_fam @{
>>>>> +  int a;
>>>>> +  int b[];
>>>>> +@};
>>>>> +@end smallexample
>>>>> +
>>>>> +If all the members of a union are flexible array member, the size of
>>> 
>>> It’s for the following case:
>>> 
>>> union with_fam_3 {
>>>   char a[];
>>>   int b[];
>>> }
>>> 
>>> And also include:  (the only member of a union is a flexible array member as you mentioned below)
>>> 
>>> union with_fam_1 {
>>>   char a[];
>>> }
>>> 
>>> So, I think the original sentence:
>>> 
>>> “If all the members of a union are flexible array member, the size of”
>>> 
>>> Should be better than the below:
>>>> 
>>>> "If the only member of a union is a flexible array member”
>> How about the following wording?
>> "If every member of a union is flexible array member, the size of”
> 
> "is a flexible array member", sure.

Okay, will update the doc.

Thanks a lot.

Qing
> 
> Jason
> 


  reply	other threads:[~2024-04-30 21:53 UTC|newest]

Thread overview: 15+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2024-04-30 14:58 [PATCH v3 0/4]Allow " Qing Zhao
2024-04-30 14:58 ` [PATCH v3 1/4] Allow " Qing Zhao
2024-04-30 21:27   ` Jason Merrill
2024-04-30 21:45     ` Qing Zhao
2024-04-30 21:49       ` Qing Zhao
2024-04-30 21:52         ` Jason Merrill
2024-04-30 21:53           ` Qing Zhao [this message]
2024-04-30 21:51       ` Jason Merrill
2024-04-30 23:55         ` Kees Cook
2024-05-01 14:02           ` Qing Zhao
2024-04-30 14:58 ` [PATCH v3 2/4] C and C++ FE changes Qing Zhao
2024-04-30 14:58 ` [PATCH v3 3/4] Add testing cases for flexible array members in unions and alone in structures Qing Zhao
2024-04-30 14:58 ` [PATCH v3 4/4] Update the C FE routine "add_flexible_array_elts_to_size" C++ FE routine "layout_var_decl" to handle the cases when the DECL is union Qing Zhao
2024-04-30 21:29   ` Jason Merrill
2024-04-30 21:36     ` Qing Zhao

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=A27F1F3B-C705-4DE5-B493-CE84D7A95220@oracle.com \
    --to=qing.zhao@oracle.com \
    --cc=gcc-patches@gcc.gnu.org \
    --cc=jason@redhat.com \
    --cc=josmyers@redhat.com \
    --cc=keescook@chromium.org \
    --cc=richard.guenther@gmail.com \
    --cc=siddhesh@gotplt.org \
    --cc=uecker@tugraz.at \
    /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).