On Fri, Sep 23, 2016 at 07:14:00AM -0400, Nathan Sidwell wrote:
> --- c/c-parser.c      (revision 240420)
> +++ c/c-parser.c      (working copy)
> @@ -10882,6 +10882,7 @@ c_parser_omp_clause_collapse (c_parser *
>    location_t loc;
>  
>    check_no_duplicate_clause (list, OMP_CLAUSE_COLLAPSE, "collapse");
> +  check_no_duplicate_clause (list, OMP_CLAUSE_TILE, "tile");

Not sure I'm very happy about the addition of OpenACC specific tests in
clause parsing that is used also for OpenMP and Cilk+, but I guess I can
live with that.

> --- cp/pt.c   (revision 240420)
> +++ cp/pt.c   (working copy)
> @@ -14543,6 +14543,7 @@ tsubst_omp_clauses (tree clauses, enum c
>        nc = copy_node (oc);
>        OMP_CLAUSE_CHAIN (nc) = new_clauses;
>        new_clauses = nc;
> +      bool needs_ice = false;
>  
>        switch (OMP_CLAUSE_CODE (nc))
>       {
> @@ -14572,10 +14573,16 @@ tsubst_omp_clauses (tree clauses, enum c
>           = tsubst_omp_clause_decl (OMP_CLAUSE_DECL (oc), args, complain,
>                                     in_decl);
>         break;
> +     case OMP_CLAUSE_COLLAPSE:
> +     case OMP_CLAUSE_TILE:
> +       /* These clauses really need a positive integral constant
> +          expression, but we don't have a predicate for that
> +          (yet).  */
> +       needs_ice = true;
> +       /* FALLTHRU */

But why do you need this (at least for OMP_CLAUSE_COLLAPSE)?
The OMP_CLAUSE_COLLAPSE (and OMP_CLAUSE_ORDERED if not NULL) argument
is required to be INTEGER_CST already during parsing, it can't be even
template argument etc. (because we need that number already during parsing
to find out how many nested loops to parse specially).
So I don't see how would the last argument to tsubst_expr make any
difference there.

If OMP_CLAUSE_TILE needs something different, then perhaps it should be
handled just on its own, and just call tsubst_expr on the argument with the
other options, the needs_ice is just confusing.

>       case OMP_CLAUSE_IF:
>       case OMP_CLAUSE_NUM_THREADS:
>       case OMP_CLAUSE_SCHEDULE:
> -     case OMP_CLAUSE_COLLAPSE:
>       case OMP_CLAUSE_FINAL:
>       case OMP_CLAUSE_DEVICE:
>       case OMP_CLAUSE_DIST_SCHEDULE:
> @@ -14596,8 +14603,8 @@ tsubst_omp_clauses (tree clauses, enum c
>       case OMP_CLAUSE_ASYNC:
>       case OMP_CLAUSE_WAIT:
>         OMP_CLAUSE_OPERAND (nc, 0)
> -         = tsubst_expr (OMP_CLAUSE_OPERAND (oc, 0), args, complain, 
> -                        in_decl, /*integral_constant_expression_p=*/false);
> +         = tsubst_expr (OMP_CLAUSE_OPERAND (oc, 0), args, complain, in_decl,
> +                        /*integral_constant_expression_p=*/needs_ice);
>         break;
>       case OMP_CLAUSE_REDUCTION:
>         if (OMP_CLAUSE_REDUCTION_PLACEHOLDER (oc))

        Jakub

Reply via email to