This is the mail archive of the gcc-patches@gcc.gnu.org mailing list for the GCC project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

Re: fix c/17396


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)


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]