summaryrefslogtreecommitdiff
path: root/gcc/cp/cp-array-notation.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/cp/cp-array-notation.c
parent0f2f527847aa3e4a5930ed076f5e9f84bad2a3c6 (diff)
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/cp/cp-array-notation.c')
-rw-r--r--gcc/cp/cp-array-notation.c5
1 files changed, 4 insertions, 1 deletions
diff --git a/gcc/cp/cp-array-notation.c b/gcc/cp/cp-array-notation.c
index 6b910fc3a76f..20f741aaebc3 100644
--- a/gcc/cp/cp-array-notation.c
+++ b/gcc/cp/cp-array-notation.c
@@ -1404,7 +1404,10 @@ build_array_notation_ref (location_t loc, tree array, tree start, tree length,
if (TREE_CODE (type) == ARRAY_TYPE || TREE_CODE (type) == POINTER_TYPE)
TREE_TYPE (array_ntn_expr) = TREE_TYPE (type);
else
- gcc_unreachable ();
+ {
+ error_at (loc, "base of array section must be pointer or array type");
+ return error_mark_node;
+ }
SET_EXPR_LOCATION (array_ntn_expr, loc);
return array_ntn_expr;