aboutsummaryrefslogtreecommitdiffstats
path: root/gcc-4.9/gcc/c
diff options
context:
space:
mode:
authorRong Xu <xur@google.com>2014-09-02 15:29:57 -0700
committerRong Xu <xur@google.com>2014-09-02 15:29:57 -0700
commite97c99f15937e5762a973b25192aab824126a6d3 (patch)
tree7f0be3ff7c7d976af06887dc50accd68f7630a7f /gcc-4.9/gcc/c
parentf1c18afafc2b321465ae6b07ede127095942d7dc (diff)
downloadtoolchain_gcc-e97c99f15937e5762a973b25192aab824126a6d3.tar.gz
toolchain_gcc-e97c99f15937e5762a973b25192aab824126a6d3.tar.bz2
toolchain_gcc-e97c99f15937e5762a973b25192aab824126a6d3.zip
[gcc-4.9] Merge svn r214745 from google/gcc-4_9 branch.
Merge gcc-4_9 source r214745 from google/gcc-4_9 branch. Change-Id: Ie6fa0fd72f4b4eec3adc4db4bb922e652d1c2605
Diffstat (limited to 'gcc-4.9/gcc/c')
-rw-r--r--gcc-4.9/gcc/c/ChangeLog12
-rw-r--r--gcc-4.9/gcc/c/c-array-notation.c19
-rw-r--r--gcc-4.9/gcc/c/c-parser.c7
3 files changed, 38 insertions, 0 deletions
diff --git a/gcc-4.9/gcc/c/ChangeLog b/gcc-4.9/gcc/c/ChangeLog
index 4816d5c67..6fb49c62c 100644
--- a/gcc-4.9/gcc/c/ChangeLog
+++ b/gcc-4.9/gcc/c/ChangeLog
@@ -1,3 +1,15 @@
+2014-08-22 Igor Zamyatin <igor.zamyatin@intel.com>
+
+ PR other/62008
+ * c-parser.c (c_parser_array_notation): Check for correct
+ type of an array added.
+
+2014-08-01 Igor Zamyatin <igor.zamyatin@intel.com>
+
+ PR middle-end/61455
+ * c-array-notation.c (expand_array_notations): Handling
+ of DECL_EXPR added.
+
2014-07-16 Release Manager
* GCC 4.9.1 released.
diff --git a/gcc-4.9/gcc/c/c-array-notation.c b/gcc-4.9/gcc/c/c-array-notation.c
index 2305e1e03..be08f532e 100644
--- a/gcc-4.9/gcc/c/c-array-notation.c
+++ b/gcc-4.9/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;
diff --git a/gcc-4.9/gcc/c/c-parser.c b/gcc-4.9/gcc/c/c-parser.c
index a51af2e30..6ce277c9b 100644
--- a/gcc-4.9/gcc/c/c-parser.c
+++ b/gcc-4.9/gcc/c/c-parser.c
@@ -14074,6 +14074,13 @@ c_parser_array_notation (location_t loc, c_parser *parser, tree initial_index,
array_type = TREE_TYPE (array_value);
gcc_assert (array_type);
+ if (TREE_CODE (array_type) != ARRAY_TYPE
+ && TREE_CODE (array_type) != POINTER_TYPE)
+ {
+ error_at (loc, "base of array section must be pointer or array type");
+ c_parser_skip_until_found (parser, CPP_CLOSE_SQUARE, NULL);
+ return error_mark_node;
+ }
type = TREE_TYPE (array_type);
token = c_parser_peek_token (parser);