aboutsummaryrefslogtreecommitdiff
path: root/gcc/c
diff options
context:
space:
mode:
authorJakub Jelinek <jakub@redhat.com>2014-11-21 10:25:51 +0100
committerJakub Jelinek <jakub@gcc.gnu.org>2014-11-21 10:25:51 +0100
commitaa7da51a8c95366b781d0ce5e6cb046ef0aa899f (patch)
treec648ac0560be23d2a39d095a04c8de340e96f4bc /gcc/c
parent0daaf8aa4d32fee71136021003bca60cc350a04e (diff)
downloadgcc-aa7da51a8c95366b781d0ce5e6cb046ef0aa899f.zip
gcc-aa7da51a8c95366b781d0ce5e6cb046ef0aa899f.tar.gz
gcc-aa7da51a8c95366b781d0ce5e6cb046ef0aa899f.tar.bz2
re PR target/63764 (ICE: in verify_ssa, at tree-ssa.c:939)
PR target/63764 c-family/ * c-common.h (convert_vector_to_pointer_for_subscript): Change return type to bool. * c-common.c: Include gimple-expr.c. (convert_vector_to_pointer_for_subscript): Change return type to bool. If *vecp is not lvalue_p and has VECTOR_TYPE, return true and copy it into a TARGET_EXPR and use that instead of *vecp directly. c/ * 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. cp/ * typeck.c (cp_build_array_ref): Adjust convert_vector_to_pointer_for_subscript caller. If it returns true, call non_lvalue_loc on the result. testsuite/ * c-c++-common/pr63764-1.c: New test. * c-c++-common/pr63764-2.c: New test. From-SVN: r217909
Diffstat (limited to 'gcc/c')
-rw-r--r--gcc/c/ChangeLog7
-rw-r--r--gcc/c/c-typeck.c14
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;
}
}