diff options
author | Roger Sayle <roger@eyesopen.com> | 2006-04-28 19:59:57 +0000 |
---|---|---|
committer | Roger Sayle <sayle@gcc.gnu.org> | 2006-04-28 19:59:57 +0000 |
commit | a0f0ab9fc19dea21076d7b4d7e8b8c5c32b78455 (patch) | |
tree | a6a89ff234f97fde1db810e9fc1190006ae95009 | |
parent | 87ceee72364d3777b7fb602f60cde99c2c66fe41 (diff) | |
download | gcc-a0f0ab9fc19dea21076d7b4d7e8b8c5c32b78455.zip gcc-a0f0ab9fc19dea21076d7b4d7e8b8c5c32b78455.tar.gz gcc-a0f0ab9fc19dea21076d7b4d7e8b8c5c32b78455.tar.bz2 |
re PR c/25309 (ICE on initialization of a huge array)
PR c/25309
* c-typeck.c (struct spelling): Make I an unsigned HOST_WIDE_INT.
(push_array_bounds): Delete prototype. Change BOUNDS argument to
an unsigned HOST_WIDE_INT.
(print_spelling): Use HOST_WIDE_INT_PRINT_UNSIGNED to output the
array index.
(really_start_incremental_init): No need to call convert because
bitsize_zero_node is already of type bitsizetype.
(push_init_level): Extract the value of constructor_index as an
unsigned HOST_WIDE_INT quantity, using tree_low_cst.
(process_init_element): Likewise.
* gcc.dg/large-size-array-2.c: New test case.
From-SVN: r113355
-rw-r--r-- | gcc/ChangeLog | 14 | ||||
-rw-r--r-- | gcc/c-typeck.c | 13 | ||||
-rw-r--r-- | gcc/testsuite/ChangeLog | 5 | ||||
-rw-r--r-- | gcc/testsuite/gcc.dg/large-size-array-2.c | 7 |
4 files changed, 32 insertions, 7 deletions
diff --git a/gcc/ChangeLog b/gcc/ChangeLog index b7ab631..99f3503 100644 --- a/gcc/ChangeLog +++ b/gcc/ChangeLog @@ -1,3 +1,17 @@ +2006-04-28 Roger Sayle <roger@eyesopen.com> + + PR c/25309 + * c-typeck.c (struct spelling): Make I an unsigned HOST_WIDE_INT. + (push_array_bounds): Delete prototype. Change BOUNDS argument to + an unsigned HOST_WIDE_INT. + (print_spelling): Use HOST_WIDE_INT_PRINT_UNSIGNED to output the + array index. + (really_start_incremental_init): No need to call convert because + bitsize_zero_node is already of type bitsizetype. + (push_init_level): Extract the value of constructor_index as an + unsigned HOST_WIDE_INT quantity, using tree_low_cst. + (process_init_element): Likewise. + 2006-04-28 Joseph S. Myers <joseph@codesourcery.com> * gcc.c (process_command): Add program name to GCC_EXEC_PREFIX diff --git a/gcc/c-typeck.c b/gcc/c-typeck.c index 21fe125..64fa9f1 100644 --- a/gcc/c-typeck.c +++ b/gcc/c-typeck.c @@ -90,7 +90,6 @@ static tree convert_for_assignment (tree, tree, enum impl_conv, tree, tree, static tree valid_compound_expr_initializer (tree, tree); static void push_string (const char *); static void push_member_name (tree); -static void push_array_bounds (int); static int spelling_length (void); static char *print_spelling (char *); static void warning_init (const char *); @@ -4309,7 +4308,7 @@ struct spelling int kind; union { - int i; + unsigned HOST_WIDE_INT i; const char *s; } u; }; @@ -4369,7 +4368,7 @@ push_member_name (tree decl) /* Push an array bounds on the stack. Printed as [BOUNDS]. */ static void -push_array_bounds (int bounds) +push_array_bounds (unsigned HOST_WIDE_INT bounds) { PUSH_SPELLING (SPELLING_BOUNDS, bounds, u.i); } @@ -4404,7 +4403,7 @@ print_spelling (char *buffer) for (p = spelling_base; p < spelling; p++) if (p->kind == SPELLING_BOUNDS) { - sprintf (d, "[%d]", p->u.i); + sprintf (d, "[" HOST_WIDE_INT_PRINT_UNSIGNED "]", p->u.i); d += strlen (d); } else @@ -5083,7 +5082,7 @@ really_start_incremental_init (tree type) /* Vectors are like simple fixed-size arrays. */ constructor_max_index = build_int_cst (NULL_TREE, TYPE_VECTOR_SUBPARTS (constructor_type) - 1); - constructor_index = convert (bitsizetype, bitsize_zero_node); + constructor_index = bitsize_zero_node; constructor_unfilled_index = constructor_index; } else @@ -5200,7 +5199,7 @@ push_init_level (int implicit) else if (TREE_CODE (constructor_type) == ARRAY_TYPE) { constructor_type = TREE_TYPE (constructor_type); - push_array_bounds (tree_low_cst (constructor_index, 0)); + push_array_bounds (tree_low_cst (constructor_index, 1)); constructor_depth++; } @@ -6588,7 +6587,7 @@ process_init_element (struct c_expr value) /* Now output the actual element. */ if (value.value) { - push_array_bounds (tree_low_cst (constructor_index, 0)); + push_array_bounds (tree_low_cst (constructor_index, 1)); output_init_element (value.value, strict_string, elttype, constructor_index, 1); RESTORE_SPELLING_DEPTH (constructor_depth); diff --git a/gcc/testsuite/ChangeLog b/gcc/testsuite/ChangeLog index 9f2b6e7..5a7ccc9 100644 --- a/gcc/testsuite/ChangeLog +++ b/gcc/testsuite/ChangeLog @@ -1,3 +1,8 @@ +2006-04-28 Roger Sayle <roger@eyesopen.com> + + PR c/25309 + * gcc.dg/large-size-array-2.c: New test case. + 2006-04-28 Richard Guenther <rguenther@suse.de> PR target/26826 diff --git a/gcc/testsuite/gcc.dg/large-size-array-2.c b/gcc/testsuite/gcc.dg/large-size-array-2.c new file mode 100644 index 0000000..6ac31d11 --- /dev/null +++ b/gcc/testsuite/gcc.dg/large-size-array-2.c @@ -0,0 +1,7 @@ +/* PR c/25309 */ +/* { dg-do compile } */ +/* { dg-options "-O2" } */ +static char * name[] = { + [0x80000000] = "bar" + }; + |