[2/2] Add tests to verify OpenACC clause locations

Message ID 20191210142303.9948-3-frederik@codesourcery.com
State New
Headers show
Series
  • Fix column information for omp_clauses in Fortran code
Related show

Commit Message

Frederik Harwath Dec. 10, 2019, 2:23 p.m.
Check that the column information for OpenACC clauses is communicated correctly
to the middle-end, in particular by the Fortran front-end (cf. PR 92793).

2019-12-10  Frederik Harwath  <frederik@codesourcery.com>

gcc/testsuite/
	* gcc.dg/goacc/clause-locations.c: New test.
	* gfortran.dg/goacc/clause-locations.f90: New test.
---
 gcc/testsuite/gcc.dg/goacc/clause-locations.c  | 17 +++++++++++++++++
 .../gfortran.dg/goacc/clause-locations.f90     | 18 ++++++++++++++++++
 2 files changed, 35 insertions(+)
 create mode 100644 gcc/testsuite/gcc.dg/goacc/clause-locations.c
 create mode 100644 gcc/testsuite/gfortran.dg/goacc/clause-locations.f90

-- 
2.17.1

Patch

diff --git a/gcc/testsuite/gcc.dg/goacc/clause-locations.c b/gcc/testsuite/gcc.dg/goacc/clause-locations.c
new file mode 100644
index 00000000000..51184e3517b
--- /dev/null
+++ b/gcc/testsuite/gcc.dg/goacc/clause-locations.c
@@ -0,0 +1,17 @@ 
+/* Verify that the location information for clauses is correct. */
+
+void
+check_clause_columns() {
+  int i, j, sum, diff;
+
+  #pragma acc parallel
+  {
+    #pragma acc loop reduction(+:sum)
+    for (i = 1; i <= 10; i++)
+      {
+        #pragma acc loop reduction(-:diff) reduction(-:sum)  /* { dg-warning "53: conflicting reduction operations for .sum." } */
+	for (j = 1; j <= 10; j++)
+	  sum = 1;
+      }
+  }
+}
diff --git a/gcc/testsuite/gfortran.dg/goacc/clause-locations.f90 b/gcc/testsuite/gfortran.dg/goacc/clause-locations.f90
new file mode 100644
index 00000000000..29798d31542
--- /dev/null
+++ b/gcc/testsuite/gfortran.dg/goacc/clause-locations.f90
@@ -0,0 +1,18 @@ 
+! Verify that the location information for clauses is correct.
+! See also PR 92793.
+
+subroutine check_clause_columns ()
+  implicit none (type, external)
+  integer :: i, j, sum, diff
+
+  !$acc parallel
+    !$acc loop reduction(+:sum)
+    do i = 1, 10
+      !$acc loop reduction(-:diff) reduction(-:sum)  ! { dg-warning "47: conflicting reduction operations for .sum." }
+      do j = 1, 10
+            sum = 1
+      end do
+    end do
+  !$acc end parallel
+end subroutine check_clause_columns
+