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.

Reply via email to