aboutsummaryrefslogtreecommitdiffstats
path: root/gcc-4.9/gcc/c/c-parser.c
diff options
context:
space:
mode:
Diffstat (limited to 'gcc-4.9/gcc/c/c-parser.c')
-rw-r--r--gcc-4.9/gcc/c/c-parser.c7
1 files changed, 7 insertions, 0 deletions
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);