From: Siddhesh Poyarekar <siddhesh@gotplt.org>
To: Qing Zhao <qing.zhao@oracle.com>, rguenther@suse.de
Cc: gcc-patches@gcc.gnu.org, keescook@chromium.org
Subject: Re: [PATCH 2/2] Documentation Update.
Date: Wed, 1 Feb 2023 11:55:20 -0500 [thread overview]
Message-ID: <f7fa47c9-2bad-e11c-ea31-74ef4bd8068d@gotplt.org> (raw)
In-Reply-To: <20230131141140.3610133-3-qing.zhao@oracle.com>
On 2023-01-31 09:11, Qing Zhao wrote:
> Update documentation to clarify a GCC extension on structure with
> flexible array member being nested in another structure.
>
> gcc/ChangeLog:
>
> * doc/extend.texi: Document GCC extension on a structure containing
> a flexible array member to be a member of another structure.
Should this resolve pr#77650 since the proposed action there appears to
be to document these semantics?
Thanks,
Sid
> ---
> gcc/doc/extend.texi | 35 ++++++++++++++++++++++++++++++++++-
> 1 file changed, 34 insertions(+), 1 deletion(-)
>
> diff --git a/gcc/doc/extend.texi b/gcc/doc/extend.texi
> index 4a89a3eae7c..54e4baf49a9 100644
> --- a/gcc/doc/extend.texi
> +++ b/gcc/doc/extend.texi
> @@ -1748,7 +1748,40 @@ Flexible array members may only appear as the last member of a
> A structure containing a flexible array member, or a union containing
> such a structure (possibly recursively), may not be a member of a
> structure or an element of an array. (However, these uses are
> -permitted by GCC as extensions.)
> +permitted by GCC as extensions, see details below.)
> +@end itemize
> +
> +GCC extension accepts a structure containing a flexible array member, or
> +a union containing such a structure (possibly recursively) to be a member
> +of a structure.
> +
> +There are two situations:
> +
> +@itemize @bullet
> +@item
> +The structure with a flexible array member is the last field of another
> +structure, for example:
> +
> +@smallexample
> +struct flex @{ int length; char data[]; @};
> +
> +struct out_flex @{ int m; struct flex flex_data; @};
> +@end smallexample
> +
> +In the above, @code{flex_data.data[]} is considered as a flexible array too.
> +
> +@item
> +The structure with a flexible array member is the middle field of another
> +structure, for example:
> +
> +@smallexample
> +struct flex @{ int length; char data[]; @};
> +
> +struct mid_flex @{ int m; struct flex flex_data; int n; @};
> +@end smallexample
> +
> +In the above, @code{flex_data.data[]} is allowed to be extended flexibly to
> +the padding. E.g, up to 4 elements.
> @end itemize
>
> Non-empty initialization of zero-length
next prev parent reply other threads:[~2023-02-01 16:55 UTC|newest]
Thread overview: 45+ messages / expand[flat|nested] mbox.gz Atom feed top
2023-01-31 14:11 [PATCH 0/2]PR101832: Handle component_ref to a structure/union field including flexible array member for builtin_object_size Qing Zhao
2023-01-31 14:11 ` [PATCH 1/2] Handle component_ref to a structre/union field including flexible array member [PR101832] Qing Zhao
2023-02-01 11:41 ` Richard Biener
2023-02-01 14:19 ` Qing Zhao
2023-02-02 8:07 ` Richard Biener
2023-02-02 13:52 ` Qing Zhao
2023-02-02 13:54 ` Richard Biener
2023-02-02 14:38 ` Qing Zhao
2023-02-03 7:49 ` Richard Biener
2023-02-03 13:17 ` Qing Zhao
2023-02-06 9:31 ` Richard Biener
2023-02-06 14:38 ` Qing Zhao
2023-02-06 23:14 ` Joseph Myers
2023-02-07 14:54 ` Qing Zhao
2023-02-07 19:17 ` Joseph Myers
2023-02-07 19:57 ` Qing Zhao
2023-02-07 23:37 ` Joseph Myers
2023-02-08 15:06 ` Qing Zhao
2023-02-08 19:09 ` Joseph Myers
2023-02-08 19:20 ` Siddhesh Poyarekar
2023-02-08 20:51 ` Joseph Myers
2023-02-08 22:53 ` Qing Zhao
2023-02-08 23:18 ` Qing Zhao
2023-02-09 14:40 ` Qing Zhao
2023-02-09 16:46 ` Kees Cook
2023-02-10 15:25 ` Qing Zhao
2023-02-09 10:35 ` Richard Biener
2023-02-09 13:44 ` Qing Zhao
2023-02-07 15:28 ` Siddhesh Poyarekar
2023-02-07 15:38 ` Qing Zhao
2023-02-01 16:48 ` Siddhesh Poyarekar
2023-02-01 18:20 ` Qing Zhao
2023-01-31 14:11 ` [PATCH 2/2] Documentation Update Qing Zhao
2023-02-01 16:55 ` Siddhesh Poyarekar [this message]
2023-02-01 18:24 ` Qing Zhao
2023-02-01 18:57 ` Siddhesh Poyarekar
2023-02-01 19:19 ` Qing Zhao
2023-02-02 8:33 ` Richard Biener
2023-02-02 14:31 ` Qing Zhao
2023-02-02 17:05 ` Kees Cook
2023-02-03 15:56 ` Jeff Law
2023-02-03 4:25 ` Siddhesh Poyarekar
2023-02-03 14:52 ` Qing Zhao
2023-02-03 20:55 ` Joseph Myers
2023-02-03 22:38 ` 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=f7fa47c9-2bad-e11c-ea31-74ef4bd8068d@gotplt.org \
--to=siddhesh@gotplt.org \
--cc=gcc-patches@gcc.gnu.org \
--cc=keescook@chromium.org \
--cc=qing.zhao@oracle.com \
--cc=rguenther@suse.de \
/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).