diff options
Diffstat (limited to 'gcc/c')
-rw-r--r-- | gcc/c/ChangeLog | 7 | ||||
-rw-r--r-- | gcc/c/c-typeck.c | 14 |
2 files changed, 17 insertions, 4 deletions
diff --git a/gcc/c/ChangeLog b/gcc/c/ChangeLog index fa3c925..79d4183 100644 --- a/gcc/c/ChangeLog +++ b/gcc/c/ChangeLog @@ -1,3 +1,10 @@ +2014-11-21 Jakub Jelinek <jakub@redhat.com> + + PR target/63764 + * c-typeck.c (build_array_ref): Adjust + convert_vector_to_pointer_for_subscript caller. If it returns true, + call non_lvalue_loc on the result. + 2014-11-11 Richard Biener <rguenther@suse.de> * c-decl.c (c_init_decl_processing): Do not set pedantic_lvalues diff --git a/gcc/c/c-typeck.c b/gcc/c/c-typeck.c index 338ef44..67efb46 100644 --- a/gcc/c/c-typeck.c +++ b/gcc/c/c-typeck.c @@ -2495,7 +2495,8 @@ build_array_ref (location_t loc, tree array, tree index) gcc_assert (TREE_CODE (TREE_TYPE (index)) == INTEGER_TYPE); - convert_vector_to_pointer_for_subscript (loc, &array, index); + bool non_lvalue + = convert_vector_to_pointer_for_subscript (loc, &array, index); if (TREE_CODE (TREE_TYPE (array)) == ARRAY_TYPE) { @@ -2557,6 +2558,8 @@ build_array_ref (location_t loc, tree array, tree index) | TREE_THIS_VOLATILE (array)); ret = require_complete_type (rval); protected_set_expr_location (ret, loc); + if (non_lvalue) + ret = non_lvalue_loc (loc, ret); return ret; } else @@ -2569,9 +2572,12 @@ build_array_ref (location_t loc, tree array, tree index) gcc_assert (TREE_CODE (TREE_TYPE (ar)) == POINTER_TYPE); gcc_assert (TREE_CODE (TREE_TYPE (TREE_TYPE (ar))) != FUNCTION_TYPE); - return build_indirect_ref - (loc, build_binary_op (loc, PLUS_EXPR, ar, index, 0), - RO_ARRAY_INDEXING); + ret = build_indirect_ref (loc, build_binary_op (loc, PLUS_EXPR, ar, + index, 0), + RO_ARRAY_INDEXING); + if (non_lvalue) + ret = non_lvalue_loc (loc, ret); + return ret; } } |