+2016-05-26 Jakub Jelinek <jakub@redhat.com>
+
+ * c-parser.c (c_parser_omp_clause_schedule): Warn if
+ OMP_CLAUSE_SCHEDULE_CHUNK_EXPR is known not to be positive.
+
2016-05-25 Marek Polacek <polacek@redhat.com>
PR c/71265
"schedule %<auto%> does not take "
"a %<chunk_size%> parameter");
else if (TREE_CODE (TREE_TYPE (t)) == INTEGER_TYPE)
- OMP_CLAUSE_SCHEDULE_CHUNK_EXPR (c) = t;
+ {
+ /* Attempt to statically determine when the number isn't
+ positive. */
+ tree s = fold_build2_loc (loc, LE_EXPR, boolean_type_node, t,
+ build_int_cst (TREE_TYPE (t), 0));
+ protected_set_expr_location (s, loc);
+ if (s == boolean_true_node)
+ {
+ warning_at (loc, 0,
+ "chunk size value must be positive");
+ t = integer_one_node;
+ }
+ OMP_CLAUSE_SCHEDULE_CHUNK_EXPR (c) = t;
+ }
else
c_parser_error (parser, "expected integer expression");
+2016-05-26 Jakub Jelinek <jakub@redhat.com>
+
+ * semantics.c (finish_omp_clauses) <case OMP_CLAUSE_SCHEDULE>: Warn
+ if OMP_CLAUSE_SCHEDULE_CHUNK_EXPR is known not to be positive.
+
2016-05-26 Patrick Palka <ppalka@gcc.gnu.org>
PR c++/70822
break;
}
}
+ else
+ {
+ t = maybe_constant_value (t);
+ if (TREE_CODE (t) == INTEGER_CST
+ && tree_int_cst_sgn (t) != 1)
+ {
+ warning_at (OMP_CLAUSE_LOCATION (c), 0,
+ "chunk size value must be positive");
+ t = integer_one_node;
+ }
+ }
t = fold_build_cleanup_point_expr (TREE_TYPE (t), t);
}
OMP_CLAUSE_SCHEDULE_CHUNK_EXPR (c) = t;
+2016-05-26 Jakub Jelinek <jakub@redhat.com>
+
+ * openmp.c (resolve_omp_clauses): Warn if chunk_size is known not to
+ be positive.
+
2016-05-23 Jerry DeLisle <jvdelisle@gcc.gnu.org>
PR fortran/66461
|| expr->ts.type != BT_INTEGER || expr->rank != 0)
gfc_error ("SCHEDULE clause's chunk_size at %L requires "
"a scalar INTEGER expression", &expr->where);
+ else if (expr->expr_type == EXPR_CONSTANT
+ && expr->ts.type == BT_INTEGER
+ && mpz_sgn (expr->value.integer) <= 0)
+ gfc_warning (0, "INTEGER expression of SCHEDULE clause's chunk_size "
+ "at %L must be positive", &expr->where);
}
/* Check that no symbol appears on multiple clauses, except that
+2016-05-26 Jakub Jelinek <jakub@redhat.com>
+
+ * c-c++-common/gomp/schedule-1.c: New test.
+ * gfortran.dg/gomp/schedule-1.f90: New test.
+
2016-05-26 Patrick Palka <ppalka@gcc.gnu.org>
PR c++/70822
--- /dev/null
+void
+foo (void)
+{
+ int i;
+ #pragma omp for schedule(static, 1)
+ for (i = 0; i < 10; i++)
+ ;
+ #pragma omp for schedule(static, 0) /* { dg-warning "chunk size value must be positive" } */
+ for (i = 0; i < 10; i++)
+ ;
+ #pragma omp for schedule(static, -7) /* { dg-warning "chunk size value must be positive" } */
+ for (i = 0; i < 10; i++)
+ ;
+}
--- /dev/null
+ integer :: i
+ !$omp do schedule(static, 1)
+ do i = 1, 10
+ end do
+ !$omp do schedule(static, 0) ! { dg-warning "must be positive" }
+ do i = 1, 10
+ end do
+ !$omp do schedule(static, -7) ! { dg-warning "must be positive" }
+ do i = 1, 10
+ end do
+end
+2016-05-26 Jakub Jelinek <jakub@redhat.com>
+
+ * testsuite/libgomp.c/doacross-1.c (main): Use schedule(static)
+ instead of invalid schedule(static, 0).
+ * testsuite/libgomp.c/doacross-2.c (main): Likewise.
+
2016-05-26 Chung-Lin Tang <cltang@codesourcery.com>
* oacc-plugin.h (GOMP_PLUGIN_async_unmap_vars): Add int parameter.
#pragma omp atomic write
a[i] = 3;
}
- #pragma omp for schedule(static, 0) ordered (3) nowait
+ #pragma omp for schedule(static) ordered (3) nowait
for (i = 2; i < N / 16 - 1; i++)
for (j = 0; j < 8; j += 2)
for (k = 1; k <= 3; k++)
#pragma omp atomic write
a[i] = 3;
}
- #pragma omp for schedule(static, 0) ordered (3) nowait
+ #pragma omp for schedule(static) ordered (3) nowait
for (i = 3; i < N / 16 - 1 + f; i++)
for (j = 0; j < 8; j += 2)
for (k = 1; k <= 3; k++)
#pragma omp atomic write
c[i][j][k] = 3;
}
- #pragma omp for schedule(static, 0) ordered (3) nowait
+ #pragma omp for schedule(static) ordered (3) nowait
for (j = 0; j < N / 16 - 1; j++)
for (k = 0; k < 8; k += 2)
for (i = 3; i <= 5 + f; i++)