This is the mail archive of the
gcc-patches@gcc.gnu.org
mailing list for the GCC project.
Re: fix c/17396
- From: "Joseph S. Myers" <jsm at polyomino dot org dot uk>
- To: Richard Henderson <rth at redhat dot com>
- Cc: gcc-patches at gcc dot gnu dot org
- Date: Sat, 11 Sep 2004 18:35:34 +0000 (UTC)
- Subject: Re: fix c/17396
- References: <20040911171150.GA10394@redhat.com>
On Sat, 11 Sep 2004, Richard Henderson wrote:
> The original source is arguably wrong:
>
> #define N (((char *) &((struct sigcontext *) 0)->sc_gr) - (char *) 0)
>
> struct tag
> {
> unsigned long _pad[N];
> };
>
> The user *should* have been using offsetof. But responding to this
> with an ICE isn't acceptable either.
There should be a testcase in the testsuite. (At present, to check that
this works; later, to check it gives a proper error without an ICE. As
something that isn't an integer constant expression (as determined by the
standards or my models), as an array dimension in a struct (where VLA
structs may become deprecated), at file scope (where VLAs detected as such
aren't allowed at all), no-one should expect GCC to continue to accept
this code.)
--
Joseph S. Myers http://www.srcf.ucam.org/~jsm28/gcc/
http://www.srcf.ucam.org/~jsm28/gcc/#c90status - status of C90 for GCC 4.0
jsm@polyomino.org.uk (personal mail)
jsm28@gcc.gnu.org (Bugzilla assignments and CCs)