+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
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)
{
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))
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. */
+2014-06-30 Igor Zamyatin <igor.zamyatin@intel.com>
+
+ PR middle-end/57541
+ * 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.
+
2014-06-28 Jonathan Wakely <jwakely@redhat.com>
DR 1579
|| bif == BUILT_IN_CILKPLUS_SEC_REDUCE
|| bif == BUILT_IN_CILKPLUS_SEC_REDUCE_MUTATING)
{
+ if (call_expr_nargs (fn) == 0)
+ {
+ error_at (EXPR_LOCATION (fn), "Invalid builtin arguments");
+ return error_mark_node;
+ }
/* for bif == BUILT_IN_CILKPLUS_SEC_REDUCE_ALL_ZERO or
BUILT_IN_CILKPLUS_SEC_REDUCE_ANY_ZERO or
BUILT_IN_CILKPLUS_SEC_REDUCE_ANY_NONZERO or
if (!find_rank (location, an_builtin_fn, an_builtin_fn, true, &rank))
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))
+2014-06-30 Igor Zamyatin <igor.zamyatin@intel.com>
+
+ PR middle-end/57541
+ * c-c++-common/cilk-plus/AN/pr57541.c: New case added.
+ * c-c++-common/cilk-plus/AN/pr57541-2.c: New test.
+
2014-06-30 Zhenqiang Chen <zhenqiang.chen@linaro.org>
* ira-loop-pressure.c: New test.
--- /dev/null
+/* PR middle-end/57541 */
+/* { dg-do compile } */
+/* { dg-options "-fcilkplus" } */
+
+int foo1 ()
+{
+ int a;
+ a = __sec_reduce_add (1); /* { dg-error "Invalid builtin arguments" } */
+}
+
+int foo2 ()
+{
+ int a;
+ a = __sec_reduce_add (); /* { dg-error "Invalid builtin arguments" } */
+}
+/* PR middle-end/57541 */
/* { dg-do compile } */
/* { dg-options "-fcilkplus" } */
int A[10];
-int main () {
+int foo () {
/* C compiler uses the term "undeclared" whereas C++ compiler uses
"not declared". Thus, grepping for declared seem to be the easiest. */
A[l:s:c];
}
-/* { dg-message "note: each" "defined" { target c } 10 } */
+int foo1 (int N) {
+
+ char c = (char)N;
+ short s = (short)N;
+ A[l:s:c]; /* { dg-error "declared" } */
+}
+
+
+/* { dg-message "note: each" "defined" { target c } 11 } */