From 5e88a8f4fb8655049c84d0ba133511cd568e93d2 Mon Sep 17 00:00:00 2001 From: Igor Zamyatin Date: Mon, 30 Jun 2014 08:14:39 +0000 Subject: re PR middle-end/57541 ([Cilkplus]: internal compiler error: in gimplify_expr, at gimplify.c:7809) PR middle-end/57541 gcc/c/ * 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. gcc/cpp/ * cp-array-notation.c (expand_sec_reduce_builtin): Check that bultin argument is correct. * call.c (build_cxx_call): Check for 0 arguments in builtin call. gcc/testsuite/ * c-c++-common/cilk-plus/AN/pr57541.c: New case added. * c-c++-common/cilk-plus/AN/pr57541-2.c: New test. From-SVN: r212138 --- gcc/c/c-array-notation.c | 12 +++++++++++- 1 file changed, 11 insertions(+), 1 deletion(-) (limited to 'gcc/c/c-array-notation.c') 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)) -- cgit v1.1