This changes the code that deals with too large array sizes to use int_fits_type_p instead of relying on the TREE_OVERFLOW setting of the tree folder. The latter will break once we don't treat sizetypes specially (and they keep being unsigned).
Bootstrapped and tested on x86_64-unknown-linux-gnu, ok for trunk? Thanks, Richard. 2011-05-02 Richard Guenther <rguent...@suse.de> * c-decl.c (grokdeclarator): Instead of looking at TREE_OVERFLOW check if the constant fits in the index type. Index: trunk/gcc/c-decl.c =================================================================== *** trunk.orig/gcc/c-decl.c 2011-05-02 14:50:36.000000000 +0200 --- trunk/gcc/c-decl.c 2011-05-02 15:12:15.000000000 +0200 *************** grokdeclarator (const struct c_declarato *** 5368,5382 **** convert (index_type, size_one_node)); ! /* If that overflowed, the array is too big. ??? ! While a size of INT_MAX+1 technically shouldn't ! cause an overflow (because we subtract 1), the ! overflow is recorded during the conversion to ! index_type, before the subtraction. Handling ! this case seems like an unnecessary ! complication. */ ! if (TREE_CODE (itype) == INTEGER_CST ! && TREE_OVERFLOW (itype)) { if (name) error_at (loc, "size of array %qE is too large", --- 5368,5380 ---- convert (index_type, size_one_node)); ! /* The above overflows when size does not fit ! in index_type. ! ??? While a size of INT_MAX+1 technically shouldn't ! cause an overflow (because we subtract 1), handling ! this case seems like an unnecessary complication. */ ! if (TREE_CODE (size) == INTEGER_CST ! && !int_fits_type_p (size, index_type)) { if (name) error_at (loc, "size of array %qE is too large",