summaryrefslogtreecommitdiff
path: root/gcc/c/c-array-notation.c
diff options
context:
space:
mode:
authorkyukhin <kyukhin@138bc75d-0d04-0410-961f-82ee72b054a4>2014-08-01 16:54:27 +0000
committerkyukhin <kyukhin@138bc75d-0d04-0410-961f-82ee72b054a4>2014-08-01 16:54:27 +0000
commit3394c80c2e094ef217bb16d401593ab347b8f7d5 (patch)
tree6b22b92b1cb7eb59e88beb1c6e546153ce181301 /gcc/c/c-array-notation.c
parent33fba0d6d884cb52f0ab7009eda885a983642270 (diff)
downloadgcc-3394c80c2e094ef217bb16d401593ab347b8f7d5.tar.gz
PR middle-end/61455
gcc/c-family/ * array-notation-common.c (extract_array_notation_exprs): Handling of DECL_EXPR added. gcc/c/ * c-array-notation.c (expand_array_notations): Handling of DECL_EXPR added. gcc/cp/ * cp-array-notation.c (expand_array_notation_exprs): Handling of DECL_EXPR improved. Changed handling for INIT_EXPR. gcc/testsuite/ * c-c++-common/cilk-plus/AN/pr61455.c: New test. * c-c++-common/cilk-plus/AN/pr61455-2.c: Likewise. git-svn-id: svn+ssh://gcc.gnu.org/svn/gcc/trunk@213491 138bc75d-0d04-0410-961f-82ee72b054a4
Diffstat (limited to 'gcc/c/c-array-notation.c')
-rw-r--r--gcc/c/c-array-notation.c19
1 files changed, 19 insertions, 0 deletions
diff --git a/gcc/c/c-array-notation.c b/gcc/c/c-array-notation.c
index 67a89315e9c..597adc912a6 100644
--- a/gcc/c/c-array-notation.c
+++ b/gcc/c/c-array-notation.c
@@ -1265,6 +1265,25 @@ expand_array_notations (tree *tp, int *walk_subtrees, void *)
rhs_loc, rhs, TREE_TYPE (rhs));
}
break;
+ case DECL_EXPR:
+ {
+ tree x = DECL_EXPR_DECL (*tp);
+ if (DECL_INITIAL (x))
+ {
+ location_t loc = DECL_SOURCE_LOCATION (x);
+ tree lhs = x;
+ tree rhs = DECL_INITIAL (x);
+ DECL_INITIAL (x) = NULL;
+ tree new_modify_expr = build_modify_expr (loc, lhs,
+ TREE_TYPE (lhs),
+ NOP_EXPR,
+ loc, rhs,
+ TREE_TYPE(rhs));
+ expand_array_notations (&new_modify_expr, walk_subtrees, NULL);
+ *tp = new_modify_expr;
+ }
+ }
+ break;
case CALL_EXPR:
*tp = fix_array_notation_call_expr (*tp);
break;