mirror of
git://gcc.gnu.org/git/gcc.git
synced 2024-12-23 00:09:52 +08:00
decl.c (grokdeclarator): Copy array typedef handling from C frontend.
* decl.c (grokdeclarator): Copy array typedef handling from C frontend. * decl.c (grokdeclarator): Copy too-large array handling from C frontend. * stor-layout.c (layout_type): Don't complain about too-large array here. From-SVN: r45923
This commit is contained in:
parent
173b24b982
commit
55b3d66505
@ -1,3 +1,8 @@
|
||||
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.
|
||||
|
@ -1,3 +1,11 @@
|
||||
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
|
||||
|
@ -10888,6 +10888,18 @@ grokdeclarator (declarator, declspecs, decl_context, initialized, attrlist)
|
||||
|
||||
/* 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
|
||||
@ -11037,8 +11049,9 @@ grokdeclarator (declarator, declspecs, decl_context, initialized, attrlist)
|
||||
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));
|
||||
}
|
||||
|
@ -1443,26 +1443,6 @@ layout_type (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,
|
||||
|
Loading…
Reference in New Issue
Block a user