Hi!

This patch repeats PR67504 changes to ordered clause too, and adjusts
PR67522 testcase to also test array reductions.

2015-09-10  Jakub Jelinek  <ja...@redhat.com>

        * parser.c (cp_parser_omp_clause_ordered): Test tree_fits_shwi_p
        before INTEGRAL_TYPE_P test.

        * g++.dg/gomp/pr67504.C (foo): Add test for ordered clause with
        dependent argument.
        * g++.dg/gomp/pr67522.C (foo): Add test for invalid array section
        in reduction clause.

--- gcc/cp/parser.c.jj  2015-09-10 10:45:43.000000000 +0200
+++ gcc/cp/parser.c     2015-09-10 12:03:29.906674538 +0200
@@ -29883,8 +29883,8 @@ cp_parser_omp_clause_ordered (cp_parser
       if (num == error_mark_node)
        return list;
       num = fold_non_dependent_expr (num);
-      if (!INTEGRAL_TYPE_P (TREE_TYPE (num))
-         || !tree_fits_shwi_p (num)
+      if (!tree_fits_shwi_p (num)
+         || !INTEGRAL_TYPE_P (TREE_TYPE (num))
          || (n = tree_to_shwi (num)) <= 0
          || (int) n != n)
        {
--- gcc/testsuite/g++.dg/gomp/pr67504.C.jj      2015-09-10 10:45:39.000000000 
+0200
+++ gcc/testsuite/g++.dg/gomp/pr67504.C 2015-09-10 12:08:35.119031422 +0200
@@ -12,4 +12,8 @@ foo (T x)
   #pragma omp for collapse (x + 1) // { dg-error "collapse argument needs 
positive constant integer expression" }
   for (int i = 0; i < 10; i++)
     ;
+  #pragma omp for ordered (x + 1) // { dg-error "ordered argument needs 
positive constant integer expression" }
+  for (int i = 0; i < 10; i++)
+    for (int j = 0; j < 10; j++)
+      ;
 }
--- gcc/testsuite/g++.dg/gomp/pr67522.C.jj      2015-09-10 10:45:39.000000000 
+0200
+++ gcc/testsuite/g++.dg/gomp/pr67522.C 2015-09-10 12:16:36.681699083 +0200
@@ -17,6 +17,10 @@ foo (void)
 
   #pragma omp task depend (inout: S[0:10])     // { dg-error "is not a 
variable in" }
   ;
+
+  #pragma omp for reduction (+:S[0:10])                // { dg-error "is not a 
variable in" }
+  for (int i = 0; i < 16; i++)
+    ;
 }
 
 void

        Jakub

Reply via email to