From: David Malcolm <dmalcolm@redhat.com>
To: "Marc Nieper-Wißkirchen" <marc.nieper+gnu@gmail.com>, jit@gcc.gnu.org
Subject: Re: Flexible array member
Date: Fri, 10 Dec 2021 16:00:17 -0500 [thread overview]
Message-ID: <ca43c072be55d46a7f65198996c1e7d436e7d3ad.camel@redhat.com> (raw)
In-Reply-To: <CAEYrNrR4LxR7Wj=Zk60Jmazm7OrK5eKNZ2hHuz00oNZ_kTDkZg@mail.gmail.com>
On Fri, 2021-12-10 at 18:44 +0100, Marc Nieper-Wißkirchen via Jit
wrote:
> C99 (and thus GCC) allow defining structures that end in a flexible
> array
> member ([1]).
>
> How can this be encoded in libgccjit? Is it valid to create an array
> type
> of length 0 and use that to define the last field in a struct?
I don't know.
I did some quick grepping of the C front-end, and gcc/c/c-decl.c's
grokdeclarator has:
/* ISO C99 Flexible array members are effectively
identical to GCC's zero-length array extension. */
if (flexible_array_member || array_parm_vla_unspec_p)
itype = build_range_type (sizetype, size_zero_node,
NULL_TREE);
So using length 0 for the array type might work in libgccjit, or it
might not, as there might be something else in the IR that libgccjit
needs to set up for it to work properly. You could try it, I guess.
Sorry not to have a clearer answer.
Dave
>
> Thanks,
>
> Marc
>
> --
>
> [1] https://en.wikipedia.org/wiki/Flexible_array_member
>
prev parent reply other threads:[~2021-12-10 21:00 UTC|newest]
Thread overview: 2+ messages / expand[flat|nested] mbox.gz Atom feed top
2021-12-10 17:44 Marc Nieper-Wißkirchen
2021-12-10 21:00 ` David Malcolm [this message]
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=ca43c072be55d46a7f65198996c1e7d436e7d3ad.camel@redhat.com \
--to=dmalcolm@redhat.com \
--cc=jit@gcc.gnu.org \
--cc=marc.nieper+gnu@gmail.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).