public inbox for gcc-bugs@sourceware.org
help / color / mirror / Atom feed
From: "qinzhao at gcc dot gnu.org" <gcc-bugzilla@gcc.gnu.org>
To: gcc-bugs@gcc.gnu.org
Subject: [Bug tree-optimization/107952] tree-object-size: inconsistent size for flexible arrays nested in structs
Date: Mon, 23 Jan 2023 19:39:14 +0000	[thread overview]
Message-ID: <bug-107952-4-6jnUrp1Z9p@http.gcc.gnu.org/bugzilla/> (raw)
In-Reply-To: <bug-107952-4@http.gcc.gnu.org/bugzilla/>

https://gcc.gnu.org/bugzilla/show_bug.cgi?id=107952

qinzhao at gcc dot gnu.org changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
                 CC|                            |qinzhao at gcc dot gnu.org

--- Comment #6 from qinzhao at gcc dot gnu.org ---
(In reply to Siddhesh Poyarekar from comment #2)
> The standard does not allow the nesting, but gcc supports it as an extension.

when GCC supports it as an extension, I see two possible situations:

A. the structure with the flexible array member will be the last field of the
outer structure;

B. the structure with the flexible array member will be the middle field of the
outer structure;

I see GCC compile the above 2 cases without any complain (i.e, GCC extension
accepts both A and B) and Adding -Wpedantic issues warnings for both.

My questions:

1. Should GCC extension support the above case B? (it should NOT, right? what's
the point to support it)
2. If GCC extension support the above case A (looks like this is the case, and
some application use this case extensively, for example, Linux Kernel uses this
a lot, See bug https://gcc.gnu.org/bugzilla/show_bug.cgi?id=101832), what's the
clear definition for it? Does it still treat the flexible array member in the
inner structure as a flexible array member in the outer structure? If so, we
might need to clearly document this in GCC's extension, and then user will have
consistent expectation on this.

  parent reply	other threads:[~2023-01-23 19:39 UTC|newest]

Thread overview: 21+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2022-12-02 14:04 [Bug tree-optimization/107952] New: " siddhesh at gcc dot gnu.org
2022-12-05  8:05 ` [Bug tree-optimization/107952] " rguenth at gcc dot gnu.org
2022-12-05 12:46 ` siddhesh at gcc dot gnu.org
2022-12-05 13:15 ` jakub at gcc dot gnu.org
2022-12-05 15:11 ` rguenther at suse dot de
2022-12-05 15:28 ` siddhesh at gcc dot gnu.org
2023-01-23 19:39 ` qinzhao at gcc dot gnu.org [this message]
2023-01-23 19:44 ` qinzhao at gcc dot gnu.org
2023-01-23 21:30 ` siddhesh at gcc dot gnu.org
2023-01-24 10:04 ` rguenth at gcc dot gnu.org
2023-01-24 15:24 ` qing.zhao at oracle dot com
2023-01-25  7:32 ` rguenther at suse dot de
2023-01-25 12:44 ` siddhesh at gcc dot gnu.org
2023-01-25 15:14 ` qing.zhao at oracle dot com
2023-01-25 16:12 ` siddhesh at gcc dot gnu.org
2023-01-25 16:40 ` qing.zhao at oracle dot com
2023-01-25 21:16 ` siddhesh at gcc dot gnu.org
2023-01-25 21:43 ` qinzhao at gcc dot gnu.org
2023-01-26  7:20 ` rguenth at gcc dot gnu.org
2023-01-26 22:13 ` qinzhao at gcc dot gnu.org
2023-01-27  7:46 ` rguenther at suse dot de

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=bug-107952-4-6jnUrp1Z9p@http.gcc.gnu.org/bugzilla/ \
    --to=gcc-bugzilla@gcc.gnu.org \
    --cc=gcc-bugs@gcc.gnu.org \
    /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).