diff options
Diffstat (limited to 'gcc')
-rw-r--r-- | gcc/ChangeLog | 4 | ||||
-rw-r--r-- | gcc/c-decl.c | 6 |
2 files changed, 6 insertions, 4 deletions
diff --git a/gcc/ChangeLog b/gcc/ChangeLog index 3eb84e7..71eb7007 100644 --- a/gcc/ChangeLog +++ b/gcc/ChangeLog @@ -1,3 +1,7 @@ +2006-01-19 Richard Sandiford <richard@codesourcery.com> + + * c-decl.c (add_flexible_array_elts_to_size): Simplify vector accesses. + 2006-01-19 Jan Hubicka <jh@suse.cz> * tree-vect-patterns.c (vect_pattern_recog_1): Prevent parse error. diff --git a/gcc/c-decl.c b/gcc/c-decl.c index 8320aca..d3bf142 100644 --- a/gcc/c-decl.c +++ b/gcc/c-decl.c @@ -3076,14 +3076,12 @@ set_array_declarator_inner (struct c_declarator *decl, static void add_flexible_array_elts_to_size (tree decl, tree init) { - unsigned int size; tree elt, type; - size = VEC_length (constructor_elt, CONSTRUCTOR_ELTS (init)); - if (size == 0) + if (VEC_empty (constructor_elt, CONSTRUCTOR_ELTS (init))) return; - elt = VEC_index (constructor_elt, CONSTRUCTOR_ELTS (init), size - 1)->value; + elt = VEC_last (constructor_elt, CONSTRUCTOR_ELTS (init))->value; type = TREE_TYPE (elt); if (TREE_CODE (type) == ARRAY_TYPE && TYPE_SIZE (type) == NULL_TREE |