On Tue, Jul 21, 2020 at 01:11:31PM +0200, Tobias Burnus wrote:
> --- a/gcc/c-family/c-omp.c
> +++ b/gcc/c-family/c-omp.c
> @@ -106,6 +106,18 @@ c_finish_omp_taskgroup (location_t loc, tree body, tree 
> clauses)
>  tree
>  c_finish_omp_critical (location_t loc, tree body, tree name, tree clauses)
>  {
> +  gcc_assert (!clauses || OMP_CLAUSE_CODE (clauses) == OMP_CLAUSE_HINT);
> +  if (name == NULL_TREE && clauses != NULL_TREE
> +      && INTEGRAL_TYPE_P (TREE_TYPE (OMP_CLAUSE_HINT_EXPR (clauses)))
> +      && tree_fits_shwi_p (OMP_CLAUSE_HINT_EXPR (clauses))
> +      && tree_to_shwi (OMP_CLAUSE_HINT_EXPR (clauses)) != 0)

Use
  if (name == NULL_TREE
      && clauses != NULL_TREE
      && integer_nonzerop (OMP_CLAUSE_HINT_EXPR (clauses)))
instead?

>        if (!INTEGRAL_TYPE_P (TREE_TYPE (t))
> -       || TREE_CODE (t) != INTEGER_CST)
> +       || TREE_CODE (t) != INTEGER_CST
> +       || tree_to_shwi (t) < 0)

This will ICE if using e.g. hint (-1ULL).
Better use 
          || tree_int_cst_sgn (t) == -1)
?
> +      t = fold_non_dependent_expr (t);
> +      if (!value_dependent_expression_p (t)
> +       && (!INTEGRAL_TYPE_P (TREE_TYPE (t))
> +           || !tree_fits_shwi_p (t)
> +           || tree_to_shwi (t) < 0))

See above.

        Jakub

Reply via email to