tree *detach_seen = NULL;
bool linear_variable_step_check = false;
tree *nowait_clause = NULL;
+ tree *grainsize_seen = NULL;
+ bool num_tasks_seen = false;
tree ordered_clause = NULL_TREE;
tree schedule_clause = NULL_TREE;
bool oacc_async = false;
case OMP_CLAUSE_PROC_BIND:
case OMP_CLAUSE_DEVICE_TYPE:
case OMP_CLAUSE_PRIORITY:
- case OMP_CLAUSE_GRAINSIZE:
- case OMP_CLAUSE_NUM_TASKS:
case OMP_CLAUSE_THREADS:
case OMP_CLAUSE_SIMD:
case OMP_CLAUSE_HINT:
pc = &OMP_CLAUSE_CHAIN (c);
continue;
+ case OMP_CLAUSE_GRAINSIZE:
+ grainsize_seen = pc;
+ pc = &OMP_CLAUSE_CHAIN (c);
+ continue;
+
+ case OMP_CLAUSE_NUM_TASKS:
+ num_tasks_seen = true;
+ pc = &OMP_CLAUSE_CHAIN (c);
+ continue;
+
case OMP_CLAUSE_MERGEABLE:
mergeable_seen = true;
pc = &OMP_CLAUSE_CHAIN (c);
*nogroup_seen = OMP_CLAUSE_CHAIN (*nogroup_seen);
}
+ if (grainsize_seen && num_tasks_seen)
+ {
+ error_at (OMP_CLAUSE_LOCATION (*grainsize_seen),
+ "%<grainsize%> clause must not be used together with "
+ "%<num_tasks%> clause");
+ *grainsize_seen = OMP_CLAUSE_CHAIN (*grainsize_seen);
+ }
+
if (detach_seen)
{
if (mergeable_seen)
bool mergeable_seen = false;
bool implicit_moved = false;
bool target_in_reduction_seen = false;
+ bool num_tasks_seen = false;
bitmap_obstack_initialize (NULL);
bitmap_initialize (&generic_head, &bitmap_default_obstack);
/* FALLTHRU */
case OMP_CLAUSE_NUM_TASKS:
+ if (OMP_CLAUSE_CODE (c) == OMP_CLAUSE_NUM_TASKS)
+ num_tasks_seen = true;
+ /* FALLTHRU */
+
case OMP_CLAUSE_NUM_TEAMS:
case OMP_CLAUSE_NUM_THREADS:
case OMP_CLAUSE_NUM_GANGS:
}
pc = &OMP_CLAUSE_CHAIN (c);
continue;
+ case OMP_CLAUSE_GRAINSIZE:
+ if (num_tasks_seen)
+ {
+ error_at (OMP_CLAUSE_LOCATION (c),
+ "%<grainsize%> clause must not be used together with "
+ "%<num_tasks%> clause");
+ *pc = OMP_CLAUSE_CHAIN (c);
+ continue;
+ }
+ pc = &OMP_CLAUSE_CHAIN (c);
+ continue;
case OMP_CLAUSE_ORDERED:
if (reduction_seen == -2)
error_at (OMP_CLAUSE_LOCATION (c),
resolve_positive_int_expr (omp_clauses->grainsize, "GRAINSIZE");
if (omp_clauses->num_tasks)
resolve_positive_int_expr (omp_clauses->num_tasks, "NUM_TASKS");
+ if (omp_clauses->grainsize && omp_clauses->num_tasks)
+ gfc_error ("%<GRAINSIZE%> clause at %L must not be used together with "
+ "%<NUM_TASKS%> clause", &omp_clauses->grainsize->where);
+ if (omp_clauses->lists[OMP_LIST_REDUCTION] && omp_clauses->nogroup)
+ gfc_error ("%<REDUCTION%> clause at %L must not be used together with "
+ "%<NOGROUP%> clause",
+ &omp_clauses->lists[OMP_LIST_REDUCTION]->where);
if (omp_clauses->async)
if (omp_clauses->async_expr)
resolve_scalar_int_expr (omp_clauses->async_expr, "ASYNC");
#pragma omp taskloop num_tasks (2) num_tasks (2) /* { dg-error "too many 'num_tasks' clauses" } */
for (i = 0; i < 8; ++i)
f0 ();
- #pragma omp taskloop num_tasks (1) grainsize (2)
+ #pragma omp taskloop num_tasks (1) grainsize (2) /* { dg-error "'grainsize' clause must not be used together with 'num_tasks' clause" } */
for (i = 0; i < 8; ++i)
f0 ();
- #pragma omp taskloop grainsize (2) num_tasks (2)
+ #pragma omp taskloop grainsize (2) num_tasks (2) /* { dg-error "'grainsize' clause must not be used together with 'num_tasks' clause" } */
for (i = 0; i < 8; ++i)
f0 ();
#pragma omp taskloop collapse (1) collapse (1) /* { dg-error "too many 'collapse' clauses" } */
--- /dev/null
+subroutine nogroup_reduction
+ integer :: i, r
+ r = 0
+!$omp taskloop nogroup reduction(+:r) ! { dg-error "'REDUCTION' clause at .1. must not be used together with 'NOGROUP' clause" }
+ do i = 1, 32
+ r = r + i
+ end do
+end
+subroutine grainsize_num_tasks
+ integer :: i
+!$omp taskloop grainsize(2) num_tasks(2) ! { dg-error "'GRAINSIZE' clause at .1. must not be used together with 'NUM_TASKS' clause" }
+ do i = 1, 32
+ end do
+end