diff --git a/gcc/ChangeLog b/gcc/ChangeLog index 3eb84e7a71dff6e5036f63fc032239dff69a3e8d..71eb7007f46428ba0bbace4b7dcb3ece743c68d2 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 8320acaf6514668d51a547477ef967493d5c40e6..d3bf14290c8095c3a4ab0bc3b83747a3d2d4eedb 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