diff options
Diffstat (limited to 'gcc/c')
-rw-r--r-- | gcc/c/ChangeLog | 7 | ||||
-rw-r--r-- | gcc/c/c-typeck.c | 7 |
2 files changed, 11 insertions, 3 deletions
diff --git a/gcc/c/ChangeLog b/gcc/c/ChangeLog index c65f2e9..9bb5ec1 100644 --- a/gcc/c/ChangeLog +++ b/gcc/c/ChangeLog @@ -1,3 +1,10 @@ +2016-05-24 Richard Biener <rguenther@suse.de> + + PR middle-end/70434 + PR c/69504 + * c-typeck.c (build_array_ref): Do not complain about indexing + non-lvalue vectors. Adjust for function name change. + 2016-05-20 Martin Sebor <msebor@redhat.com> PR c/71115 diff --git a/gcc/c/c-typeck.c b/gcc/c/c-typeck.c index 7c9b078..74bad2a 100644 --- a/gcc/c/c-typeck.c +++ b/gcc/c/c-typeck.c @@ -2583,8 +2583,8 @@ build_array_ref (location_t loc, tree array, tree index) gcc_assert (TREE_CODE (TREE_TYPE (index)) == INTEGER_TYPE); - bool non_lvalue - = convert_vector_to_pointer_for_subscript (loc, &array, index); + bool was_vector = VECTOR_TYPE_P (TREE_TYPE (array)); + bool non_lvalue = convert_vector_to_array_for_subscript (loc, &array, index); if (TREE_CODE (TREE_TYPE (array)) == ARRAY_TYPE) { @@ -2613,7 +2613,8 @@ build_array_ref (location_t loc, tree array, tree index) return error_mark_node; } - if (pedantic || warn_c90_c99_compat) + if ((pedantic || warn_c90_c99_compat) + && ! was_vector) { tree foo = array; while (TREE_CODE (foo) == COMPONENT_REF) |