On Wed, Mar 25, 2009 at 6:37 AM, Joseph S. Myers <jos...@codesourcery.com> wrote: > On Wed, 25 Mar 2009, H.J. Lu wrote: > >> gcc.c-torture/compile/pr16566-2.c has >> >> --- >> struct A >> { >> int i; >> int x[]; >> }; >> >> int foo(struct A a) >> { >> return (a,a).x[0]; >> } >> --- >> >> foo will return a random number. I don't think it should be allowed. > > This is a perfectly ordinary case of accessing outside array bounds, > undefined behavior at runtime if the code in question is ever executed but > OK in a program as long as the dereference isn't executed.
Shouldn't gcc warn out of bound array access here? -- H.J.