As the subject states, this patch maps the '*' tile clause arguments
onto integer_zero_node. Before the fortran FE was using mapping it onto
-1. This patch should make the clause parsing in fortran on par with the
C and C++ FEs.

This patch has been applied to gomp-4_0-branch.

Cesar
2016-10-03  Cesar Philippidis  <ce...@codesourcery.com>

	gcc/fortran/	
	* openmp.c (resolve_oacc_loop_blocks): Use integer zero to
        represent the '*' tile argument.

	gcc/testsuite/
	* gfortran.dg/goacc/tile-lowering.f95: New test.


diff --git a/gcc/fortran/openmp.c b/gcc/fortran/openmp.c
index 399b5d1..df489ba 100644
--- a/gcc/fortran/openmp.c
+++ b/gcc/fortran/openmp.c
@@ -5183,11 +5183,11 @@ resolve_oacc_loop_blocks (gfc_code *code)
 	  if (el->expr == NULL)
 	    {
 	      /* NULL expressions are used to represent '*' arguments.
-		 Convert those to a -1 expressions.  */
+		 Convert those to a 0 expressions.  */
 	      el->expr = gfc_get_constant_expr (BT_INTEGER,
 						gfc_default_integer_kind,
 						&code->loc);
-	      mpz_set_si (el->expr->value.integer, -1);
+	      mpz_set_si (el->expr->value.integer, 0);
 	    }
 	  else
 	    {
diff --git a/gcc/testsuite/gfortran.dg/goacc/tile-lowering.f95 b/gcc/testsuite/gfortran.dg/goacc/tile-lowering.f95
new file mode 100644
index 0000000..b36cdc7
--- /dev/null
+++ b/gcc/testsuite/gfortran.dg/goacc/tile-lowering.f95
@@ -0,0 +1,85 @@
+! { dg-do compile }
+! { dg-additional-options "-fdump-tree-original" }
+
+subroutine test
+  integer i, j, k
+
+  !$acc parallel
+  !$acc loop tile (1)
+  do i = 1, 10
+  end do
+
+  !$acc loop tile (*)
+  do i = 1, 10
+  end do
+  
+  !$acc loop tile (1,2)
+  do i = 1, 10
+     do j = 1, 10
+     end do
+  end do
+
+  !$acc loop tile (*,2)
+  do i = 1, 10
+     do j = 1, 10
+     end do
+  end do
+
+  !$acc loop tile (1,*)
+  do i = 1, 10
+     do j = 1, 10
+     end do
+  end do
+
+  !$acc loop tile (*,*)
+  do i = 1, 10
+     do j = 1, 10
+     end do
+  end do
+
+  
+  !$acc loop tile (1,2,3)
+  do i = 1, 10
+     do j = 1, 10
+        do k = 1, 10
+        end do
+     end do
+  end do
+
+  !$acc loop tile (*,2,3)
+  do i = 1, 10
+     do j = 1, 10
+        do k = 1, 10
+        end do
+     end do
+  end do
+
+  !$acc loop tile (1,*,3)
+  do i = 1, 10
+     do j = 1, 10
+        do k = 1, 10
+        end do
+     end do
+  end do
+
+  !$acc loop tile (1,2,*)
+  do i = 1, 10
+     do j = 1, 10
+        do k = 1, 10
+        end do
+     end do
+  end do
+  !$acc end parallel
+end subroutine test
+
+! { dg-final { scan-tree-dump-times "tile\\(1\\)" 1 "original" } }
+! { dg-final { scan-tree-dump-times "tile\\(0\\)" 1 "original" } }
+! { dg-final { scan-tree-dump-times "tile\\(1, 2\\)" 1 "original" } }
+! { dg-final { scan-tree-dump-times "tile\\(0, 2\\)" 1 "original" } }
+! { dg-final { scan-tree-dump-times "tile\\(1, 0\\)" 1 "original" } }
+! { dg-final { scan-tree-dump-times "tile\\(0, 0\\)" 1 "original" } }
+! { dg-final { scan-tree-dump-times "tile\\(1, 2, 3\\)" 1 "original" } }
+! { dg-final { scan-tree-dump-times "tile\\(0, 2, 3\\)" 1 "original" } }
+! { dg-final { scan-tree-dump-times "tile\\(1, 0, 3\\)" 1 "original" } }
+! { dg-final { scan-tree-dump-times "tile\\(1, 2, 0\\)" 1 "original" } }
+

Reply via email to