Commit 355a9e43 by James E Wilson Committed by Jim Wilson

Emit an error for too large arrays instead of an ICE.

PR tree-optimization/21105
* c-decl.c (grokdeclarator): Use TYPE_SIZE_UNIT not TYPE_SIZE in
TREE_OVERFLOW check.
* gcc.dg/large-size-array.c: New.

From-SVN: r103164
parent 3881a11b
2005-08-16 James E Wilson <wilson@specifix.com>
PR tree-optimization/21105
* c-decl.c (grokdeclarator): Use TYPE_SIZE_UNIT not TYPE_SIZE in
TREE_OVERFLOW check.
2005-08-16 David Edelsohn <edelsohn@gnu.org>
* config/rs6000/rs6000.md (ltu<mode>): Convert to mode macro.
......
......@@ -4384,7 +4384,7 @@ grokdeclarator (const struct c_declarator *declarator,
if (TREE_CODE (type) == ARRAY_TYPE
&& COMPLETE_TYPE_P (type)
&& TREE_CODE (TYPE_SIZE (type)) == INTEGER_CST
&& TREE_OVERFLOW (TYPE_SIZE (type)))
&& TREE_OVERFLOW (TYPE_SIZE_UNIT (type)))
{
error ("size of array %qs is too large", name);
/* If we proceed with the array type as it is, we'll eventually
......
2005-08-16 James E Wilson <wilson@specifix.com>
PR tree-optimization/21105
* gcc.dg/large-size-array.c: New.
2005-08-16 Dorit Nuzman <dorit@il.ibm.com>
* gcc.dg/vect/vect-40: Use aligned arrays instead of arrays to aligned
......
/* { dg-do compile } */
#include <limits.h>
#ifdef __LP64__
#define DIM UINT_MAX>>1
#else
#define DIM USHORT_MAX>>1
#endif
int
sub (int *a)
{
return a[0];
}
int
main (void)
{
int a[DIM][DIM]; /* { dg-error "size of array 'a' is too large" } */
return sub (&a[0][0]);
}
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment