+2001-10-01 Jason Merrill <jason_merrill@redhat.com>
+
+ * stor-layout.c (layout_type): Don't complain about too-large
+ array here.
+
Mon Oct 1 06:43:41 2001 Richard Kenner <kenner@vlsi1.ultra.nyu.edu>
* function.c (keep_stack_depressed): Don't use delete_insn.
+2001-10-01 Jason Merrill <jason_merrill@redhat.com>
+
+ * decl.c (grokdeclarator): Copy array typedef handling from C
+ frontend.
+
+ * decl.c (grokdeclarator): Copy too-large array handling from C
+ frontend.
+
2001-09-29 Alexandre Oliva <aoliva@redhat.com>
* config-lang.in (target_libs): Added target-gperf, so that we
/* Now TYPE has the actual type. */
+ /* Did array size calculations overflow? */
+
+ if (TREE_CODE (type) == ARRAY_TYPE
+ && COMPLETE_TYPE_P (type)
+ && TREE_OVERFLOW (TYPE_SIZE (type)))
+ {
+ error ("size of array `%s' is too large", name);
+ /* If we proceed with the array type as it is, we'll eventully
+ crash in tree_low_cst(). */
+ type = error_mark_node;
+ }
+
if (explicitp == 1 || (explicitp && friendp))
{
/* [dcl.fct.spec] The explicit specifier shall only be used in
a distinct type, so that each identifier's size can be
controlled separately by its own initializer. */
- if (type == typedef_type && TREE_CODE (type) == ARRAY_TYPE
- && TYPE_DOMAIN (type) == NULL_TREE)
+ if (type != 0 && typedef_type != 0
+ && TREE_CODE (type) == ARRAY_TYPE && TYPE_DOMAIN (type) == 0
+ && TYPE_MAIN_VARIANT (type) == TYPE_MAIN_VARIANT (typedef_type))
{
type = build_cplus_array_type (TREE_TYPE (type), TYPE_DOMAIN (type));
}
if (TYPE_SIZE_UNIT (element) != 0 && ! integer_onep (element_size))
TYPE_SIZE_UNIT (type)
= size_binop (MULT_EXPR, TYPE_SIZE_UNIT (element), length);
-
- /* Complain if the user has requested an array too large to
- fit in size_t.
-
- ??? Disable this test for signed sizetypes. This has the effect
- of disabling it for Ada, where it will cause trouble. However,
- this test doesn't make sense for C either since there should
- be no problem with a type whose size overflows, only an
- object whose size overflows. */
- if (TREE_CODE (TYPE_SIZE (type)) == INTEGER_CST
- && TREE_OVERFLOW (TYPE_SIZE (type))
- && TREE_UNSIGNED (TREE_TYPE (TYPE_SIZE (type))))
- {
- error ("requested array too large for target");
-
- /* Avoid crashing later. */
- TYPE_SIZE (type) = element_size;
- if (TYPE_SIZE_UNIT (type))
- TYPE_SIZE_UNIT (type) = TYPE_SIZE_UNIT (element);
- }
}
/* Now round the alignment and size,