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,TESTSUITE]Reduce malloc size used by ipa-sra-2.c


On Sun, 1 Nov 2009, Richard Guenther wrote:

> On Sun, Nov 1, 2009 at 12:37 PM, Andrew Hutchinson
> <andrewhutchinson@cox.net> wrote:
> > That's an interesting point !
> >
> > AVR does not reject this. It never gets to see it. Error is:
> >
> > error: size of array 'data' is too large
> >
> > which appear to come from c-decl.c or perhaps c-common.c
> >
> > The former has check for array size (in bytes) overflowing integer max+1.
> > Which for AVR would be 32768 bytes. (this actually raises another issue
> > where 'unsigned' size of ?65536 bytes should be limit)
> 
> Hmm.  I think the constant is parsed as a long (which is 32bits on avr?),
> but the C frontend uses c_common_signed_type (sizetype) as canonical
> index type here which is only 16 bits (you have 16bits sizetype I guess).
> 
> I suspect that choosing such a small sizetype is the problem, but the
> C frontend rejecting the program is probably non-conforming as well
> (it could warn and put error_mark_node in the size or so).

Types larger than half the address space are problematic for C because of 
difficulties in computing the signed difference between two pointers into 
the same object.

C99 only requires 65535 bytes in an object to be supported in hosted 
environments (thus, it is expected that 16-bit systems are too small to 
support a full hosted implementation of C99).

-- 
Joseph S. Myers
joseph@codesourcery.com

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