On Fri, Mar 25, 2022 at 08:03:38PM -0600, Sandra Loosemore wrote:
>     This patch adds support for OMP 5.1 "canonical loop nest form" to the
>     Fortran front end, marks non-rectangular loops for processing
>     by the middle end, and implements missing checks in the gimplifier
>     for additional prohibitions on non-rectangular loops.
>     
>     Note that the OMP spec also prohibits non-rectangular loops with the TILE
>     construct; that construct hasn't been implemented yet, so that error will
>     need to be filled in later.
>     
>       gcc/fortran/
>       * gfortran.h (struct gfc_omp_clauses): Add non_rectangular bit.
>       * openmp.cc (is_outer_iteration_variable): New function.
>       (expr_is_invariant): New function.
>       (bound_expr_is_canonical): New function.
>       (resolve_omp_do): Replace existing non-rectangularity error with
>       check for canonical form and setting non_rectangular bit.
>       * trans-openmp.cc (gfc_trans_omp_do): Transfer non_rectangular
>       flag to generated tree structure.
>     
>       gcc/
>       * gimplify.cc (gimplify_omp_for): Update messages for SCHEDULED
>       and ORDERED clause conflict errors.  Add check for GRAINSIZE and
>       NUM_TASKS on TASKLOOP.
>     
>       gcc/testsuite/
>       * c-c++-common/gomp/loop-6.c (f3): New function to test TASKLOOP
>       diagnostics.
>       * gfortran.dg/gomp/collapse1.f90: Update expected messages.
>       * gfortran.dg/gomp/pr85313.f90: Remove dg-error on non-rectangular
>       loops that are now accepted.
>       * gfortran.dg/gomp/non-rectangular-loop.f90: New file.
>       * gfortran.dg/gomp/canonical-loop-1.f90: New file.
>       * gfortran.dg/gomp/canonical-loop-2.f90: New file.
> 
> --- a/gcc/gimplify.cc
> +++ b/gcc/gimplify.cc
> @@ -12468,11 +12468,11 @@ gimplify_omp_for (tree *expr_p, gimple_seq *pre_p)
>                              OMP_CLAUSE_SCHEDULE))
>           error_at (EXPR_LOCATION (for_stmt),
>                     "%qs clause may not appear on non-rectangular %qs",
> -                   "schedule", "for");
> +                   "schedule", (lang_GNU_Fortran () ? "do" : "for"));
>         if (omp_find_clause (OMP_FOR_CLAUSES (for_stmt), OMP_CLAUSE_ORDERED))
>           error_at (EXPR_LOCATION (for_stmt),
>                     "%qs clause may not appear on non-rectangular %qs",
> -                   "ordered", "for");
> +                   "ordered", (lang_GNU_Fortran () ? "do" : "for"));

Please drop the superfluous ()s around the argument, just use
                      "...", lang_GNU_Fortran () ? "do" : "for");

Ok for trunk with that nit fixed.  And thanks for discovering the missing
grainsize/num_tasks checks.

        Jakub

Reply via email to