This is the mail archive of the
gcc-patches@gcc.gnu.org
mailing list for the GCC project.
Re: [PATCH] c/67882 - improve -Warray-bounds for invalid offsetof
- From: Jakub Jelinek <jakub at redhat dot com>
- To: Bernd Schmidt <bschmidt at redhat dot com>
- Cc: Martin Sebor <msebor at gmail dot com>, Joseph Myers <joseph at codesourcery dot com>, Gcc Patch List <gcc-patches at gcc dot gnu dot org>
- Date: Mon, 26 Oct 2015 13:01:01 +0100
- Subject: Re: [PATCH] c/67882 - improve -Warray-bounds for invalid offsetof
- Authentication-results: sourceware.org; auth=none
- References: <5626A5A0 dot 7040003 at redhat dot com> <alpine dot DEB dot 2 dot 10 dot 1510202200590 dot 9787 at digraph dot polyomino dot org dot uk> <562A164A dot 2030002 at redhat dot com> <562A4EF2 dot 8080901 at gmail dot com> <alpine dot DEB dot 2 dot 10 dot 1510231650090 dot 20997 at digraph dot polyomino dot org dot uk> <562A7230 dot 6060103 at redhat dot com> <562A9B49 dot 7090600 at gmail dot com> <562E1122 dot 9090503 at redhat dot com> <20151026114738 dot GQ478 at tucnak dot redhat dot com> <562E1541 dot 4030508 at redhat dot com>
- Reply-to: Jakub Jelinek <jakub at redhat dot com>
On Mon, Oct 26, 2015 at 12:57:53PM +0100, Bernd Schmidt wrote:
> On 10/26/2015 12:47 PM, Jakub Jelinek wrote:
>
> >Because the amount of code that uses this (including GCC itself) is just too
> >huge, so everywhere in the middle-end we also special case last array members of
> >structs. While C99+ has flexible array members, e.g. C++ does not, so users
> >are left with using struct { ... type fld[1]; };
>
> Yes, and that case is documented. However, the issue is arrays declared with
> a larger size than 1 or 0 - is there really code using them as flexible
> array members?
I believe so, though don't have pointers to that right now. But vaguely
remember we saw various cases of using 2 or other values too.
Jakub