summaryrefslogtreecommitdiff
path: root/gcc/c
diff options
context:
space:
mode:
authorkyukhin <kyukhin@138bc75d-0d04-0410-961f-82ee72b054a4>2014-08-22 09:37:01 +0000
committerkyukhin <kyukhin@138bc75d-0d04-0410-961f-82ee72b054a4>2014-08-22 09:37:01 +0000
commit5fdda74b833e3dde26563cce639ffce217e0414a (patch)
tree6f165c688a91a7330fa85c3c0db62bf89b086692 /gcc/c
parent0f2f527847aa3e4a5930ed076f5e9f84bad2a3c6 (diff)
downloadgcc-5fdda74b833e3dde26563cce639ffce217e0414a.tar.gz
PR other/62008
gcc/c/ * c-parser.c (c_parser_array_notation): Check for correct type of an array added. gcc/cp/ * cp-array-notation.c (build_array_notation_ref): Added correct handling of case with incorrect array. gcc/testsuite/ * c-c++-common/cilk-plus/AN/pr62008.c: New test. git-svn-id: svn+ssh://gcc.gnu.org/svn/gcc/trunk@214305 138bc75d-0d04-0410-961f-82ee72b054a4
Diffstat (limited to 'gcc/c')
-rw-r--r--gcc/c/ChangeLog6
-rw-r--r--gcc/c/c-parser.c7
2 files changed, 13 insertions, 0 deletions
diff --git a/gcc/c/ChangeLog b/gcc/c/ChangeLog
index e5429ac617c..77bc05bbcca 100644
--- a/gcc/c/ChangeLog
+++ b/gcc/c/ChangeLog
@@ -1,3 +1,9 @@
+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-19 Marek Polacek <polacek@redhat.com>
PR c++/62153
diff --git a/gcc/c/c-parser.c b/gcc/c/c-parser.c
index d5887972088..d634bb1795f 100644
--- a/gcc/c/c-parser.c
+++ b/gcc/c/c-parser.c
@@ -14170,6 +14170,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);