diff options
author | Igor Zamyatin <igor.zamyatin@intel.com> | 2014-08-22 09:37:01 +0000 |
---|---|---|
committer | Kirill Yukhin <kyukhin@gcc.gnu.org> | 2014-08-22 09:37:01 +0000 |
commit | 671a475e64d77f16b3fbc5aad349be68828c1318 (patch) | |
tree | 6f165c688a91a7330fa85c3c0db62bf89b086692 /gcc/c/c-parser.c | |
parent | 0bf1f5864e17b4cb2dc2868037358ceb5df65803 (diff) | |
download | gcc-671a475e64d77f16b3fbc5aad349be68828c1318.zip gcc-671a475e64d77f16b3fbc5aad349be68828c1318.tar.gz gcc-671a475e64d77f16b3fbc5aad349be68828c1318.tar.bz2 |
re PR other/62008 (CilkPlus Array Notation ICE in build_array_notation_ref when trying to build a multidimensional array from a pointer.)
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.
From-SVN: r214305
Diffstat (limited to 'gcc/c/c-parser.c')
-rw-r--r-- | gcc/c/c-parser.c | 7 |
1 files changed, 7 insertions, 0 deletions
diff --git a/gcc/c/c-parser.c b/gcc/c/c-parser.c index d588797..d634bb1 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); |