PR c/25309
* c-common.c (complete_array_type): Diagnose too-large arrays and
set type to error_mark_node.
testsuite:
* gcc.dg/large-size-array-2.c: Expect diagnostic for too-large
array.
* gcc.dg/large-size-array-4.c: New. Copy of large-size-array-2.c
without -O2.
From-SVN: r128811
+2007-09-26 Joseph Myers <joseph@codesourcery.com>
+
+ PR c/25309
+ * c-common.c (complete_array_type): Diagnose too-large arrays and
+ set type to error_mark_node.
+
2007-09-26 Richard Guenther <rguenther@suse.de>
PR tree-optimization/30375
else
type = c_build_qualified_type (main_type, quals);
+ if (COMPLETE_TYPE_P (type)
+ && TREE_CODE (TYPE_SIZE_UNIT (type)) == INTEGER_CST
+ && TREE_OVERFLOW (TYPE_SIZE_UNIT (type)))
+ {
+ error ("size of array is too large");
+ /* If we proceed with the array type as it is, we'll eventually
+ crash in tree_low_cst(). */
+ type = error_mark_node;
+ }
+
*ptype = type;
return failure;
}
+2007-09-26 Joseph Myers <joseph@codesourcery.com>
+
+ PR c/25309
+ * gcc.dg/large-size-array-2.c: Expect diagnostic for too-large
+ array.
+ * gcc.dg/large-size-array-4.c: New. Copy of large-size-array-2.c
+ without -O2.
+
2007-09-26 Richard Guenther <rguenther@suse.de>
PR tree-optimization/30375
static char * name[] = {
[0x80000000] = "bar"
};
-
+/* { dg-error "too large" "" { target { ! lp64 } } 6 } */
--- /dev/null
+/* PR c/25309 */
+/* { dg-do compile } */
+/* { dg-options "" } */
+static char * name[] = {
+ [0x80000000] = "bar"
+ };
+/* { dg-error "too large" "" { target { ! lp64 } } 6 } */