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: [PATCH][C] Change array size overflow check


On Mon, 2 May 2011, Joseph S. Myers wrote:

> On Mon, 2 May 2011, Richard Guenther wrote:
> 
> > We do have similar testcases in gcc.dg/large-size-array*.c, but not
> > exactly testing the bound.  The above testcase also complains with
> > -pedantic about
> > 
> > t.c:3:13: error: size of array 'a' is too large
> > t.c:4:1: error: overflow in constant expression [-Woverflow]
> > t.c:5:12: error: size of array 'c' is too large
> > t.c:6:1: error: overflow in constant expression [-Woverflow]
> > 
> > with and without the patch.  I can add -Wno-overflow to the flags.
> > Ok with that?
> 
> Those overflow errors are bugs (the tests have no overflowing constant 
> expression, it must be something the compiler is generating internally), 
> and it seems they only appear for 64-bit compilation for me, not for 
> 32-bit, for some reason.  But as they are independent of the patch, OK 
> with -Wno-overflow and with a PR filed for the bogus overflow errors.
> 
> (I get the overflow errors for a char array for a size of 
> ((size_t)-1 >> 4)+1 but not for ((size_t)-1 >> 4), i.e. 1ULL<<60 bytes is 
> the point where the bogus errors start.)

Committed as rev. 173297.  I filed PR48850 for the rejects-valid.

Richard.


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