diff options
Diffstat (limited to 'gcc/c')
-rw-r--r-- | gcc/c/ChangeLog | 9 | ||||
-rw-r--r-- | gcc/c/c-array-notation.c | 12 | ||||
-rw-r--r-- | gcc/c/c-parser.c | 2 |
3 files changed, 21 insertions, 2 deletions
diff --git a/gcc/c/ChangeLog b/gcc/c/ChangeLog index fa7caac..02a0f2f 100644 --- a/gcc/c/ChangeLog +++ b/gcc/c/ChangeLog @@ -1,3 +1,12 @@ +2014-06-30 Igor Zamyatin <igor.zamyatin@intel.com> + + PR middle-end/57541 + * c-array-notation.c (fix_builtin_array_notation_fn): + Check for 0 arguments in builtin call. Check that bultin argument is + correct. + * c-parser.c (c_parser_array_notation): Check for incorrect initial + index. + 2014-06-27 Sebastian Huber <sebastian.huber@embedded-brains.de> * c-parser.c (c_parser_declaration_or_fndef): Discard all type diff --git a/gcc/c/c-array-notation.c b/gcc/c/c-array-notation.c index b4015b8..67a8931 100644 --- a/gcc/c/c-array-notation.c +++ b/gcc/c/c-array-notation.c @@ -214,6 +214,13 @@ fix_builtin_array_notation_fn (tree an_builtin_fn, tree *new_var) if (an_type == BUILT_IN_NONE) return NULL_TREE; + /* Builtin call should contain at least one argument. */ + if (call_expr_nargs (an_builtin_fn) == 0) + { + error_at (EXPR_LOCATION (an_builtin_fn), "Invalid builtin arguments"); + return error_mark_node; + } + if (an_type == BUILT_IN_CILKPLUS_SEC_REDUCE || an_type == BUILT_IN_CILKPLUS_SEC_REDUCE_MUTATING) { @@ -238,7 +245,10 @@ fix_builtin_array_notation_fn (tree an_builtin_fn, tree *new_var) return error_mark_node; if (rank == 0) - return an_builtin_fn; + { + error_at (location, "Invalid builtin arguments"); + return error_mark_node; + } else if (rank > 1 && (an_type == BUILT_IN_CILKPLUS_SEC_REDUCE_MAX_IND || an_type == BUILT_IN_CILKPLUS_SEC_REDUCE_MIN_IND)) diff --git a/gcc/c/c-parser.c b/gcc/c/c-parser.c index 797d1bc..99e7fc8 100644 --- a/gcc/c/c-parser.c +++ b/gcc/c/c-parser.c @@ -14098,7 +14098,7 @@ c_parser_array_notation (location_t loc, c_parser *parser, tree initial_index, tree value_tree = NULL_TREE, type = NULL_TREE, array_type = NULL_TREE; tree array_type_domain = NULL_TREE; - if (array_value == error_mark_node) + if (array_value == error_mark_node || initial_index == error_mark_node) { /* No need to continue. If either of these 2 were true, then an error must be emitted already. Thus, no need to emit them twice. */ |