[gcc r10-8956] [OpenACC] Elaborate testcases that verify column location information [PR92793]
Thomas Schwinge
tschwinge@gcc.gnu.org
Fri Oct 30 10:29:05 GMT 2020
https://gcc.gnu.org/g:fc423b4e5b16dc02cc9f91fdfc800d00a5103dea
commit r10-8956-gfc423b4e5b16dc02cc9f91fdfc800d00a5103dea
Author: Thomas Schwinge <thomas@codesourcery.com>
Date: Thu Oct 29 16:12:38 2020 +0100
[OpenACC] Elaborate testcases that verify column location information [PR92793]
After PR92793 commit 9c81750c5bedd7883182ee2684a012c6210ebe1d "Fortran] PR
92793 - fix column used for error diagnostic", commit
d0d0ba20f2345023e9cec2419c9fb9e6cc7098c6 did "Add tests to verify OpenACC
clause locations", later fixed up in PR92901 commit
e6c90dba73291435c244decb9a89c47019cc5a45 to "Fix PR92901: Change test
expectation for C++ in OpenACC test clause-locations.c".
Now, add some more testing to verify/document the status quo.
gcc/testsuite/
PR fortran/92793
* c-c++-common/goacc/clause-locations.c: Rewrite into...
* c-c++-common/goacc/pr92793-1.c: ... this.
* gfortran.dg/goacc/clause-locations.f90: Rewrite into...
* gfortran.dg/goacc/pr92793-1.f90: ... this.
(cherry picked from commit fa410314ec94c9df2ad270c1917adc51f9147c2c)
Diff:
---
.../c-c++-common/goacc/clause-locations.c | 19 --------
gcc/testsuite/c-c++-common/goacc/pr92793-1.c | 56 ++++++++++++++++++++++
.../gfortran.dg/goacc/clause-locations.f90 | 18 -------
gcc/testsuite/gfortran.dg/goacc/pr92793-1.f90 | 47 ++++++++++++++++++
4 files changed, 103 insertions(+), 37 deletions(-)
diff --git a/gcc/testsuite/c-c++-common/goacc/clause-locations.c b/gcc/testsuite/c-c++-common/goacc/clause-locations.c
deleted file mode 100644
index 913988d9b5a..00000000000
--- a/gcc/testsuite/c-c++-common/goacc/clause-locations.c
+++ /dev/null
@@ -1,19 +0,0 @@
-/* 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." "" { target c } .-1 } */
- /* { dg-warning "56: conflicting reduction operations for .sum." "" { target c++ } .-2 } */
- for (j = 1; j <= 10; j++)
- sum = 1;
- }
- }
-}
diff --git a/gcc/testsuite/c-c++-common/goacc/pr92793-1.c b/gcc/testsuite/c-c++-common/goacc/pr92793-1.c
new file mode 100644
index 00000000000..d7a2ae48799
--- /dev/null
+++ b/gcc/testsuite/c-c++-common/goacc/pr92793-1.c
@@ -0,0 +1,56 @@
+/* Verify column location information. */
+
+/* See also 'gfortran.dg/goacc/pr92793-1.f90'. */
+
+/* { dg-additional-options "-fdump-tree-original-lineno" }, and also
+ { dg-additional-options "-fdump-tree-gimple-lineno" } as the former doesn't
+ actually contain location information. */
+
+/* No tabs. Funny indentation/spacing for a reason. */
+
+
+static void
+check ()
+{
+ int i, j, sum, diff;
+
+ #pragma acc parallel \
+ /* C, C++ location information points to the 'a' in '#pragma acc parallel'. */ \
+ /* { dg-final { scan-tree-dump-times "pr92793-1\\\.c:17:12\\\] #pragma acc parallel" 1 "original" { xfail *-*-* } } } */ \
+ /* { dg-final { scan-tree-dump-times "pr92793-1\\\.c:17:12\\\] #pragma omp target oacc_parallel" 1 "gimple" } } */
+ {
+#pragma acc loop \
+ /* C, C++ location information points to the 'a' in '#pragma acc loop'. */ \
+ /* { dg-final { scan-tree-dump-times "pr92793-1\\\.c:22:13\\\] #pragma acc loop" 1 "original" { xfail *-*-* } } } */ \
+ /* { dg-final { scan-tree-dump-times "pr92793-1\\\.c:22:13\\\] #pragma acc loop" 1 "gimple" } } */ \
+ reduction ( + : sum) /* { dg-line sum1 } */ \
+ /* C location information points to the '(' in 'reduction(+:sum)'. */ \
+ /* { dg-message "19: location of the previous reduction for 'sum'" "" { target c } sum1 } */ \
+ /* C++ location information points to 'sum' in 'reduction(+:sum)'. */ \
+ /* { dg-message "28: location of the previous reduction for 'sum'" "" { target c++ } sum1 } */ \
+ independent
+ for (i = 1; i <= 10; i++)
+ {
+ #pragma acc loop \
+ /* C, C++ location information points to the 'a' in '#pragma acc loop'. */ \
+ /* { dg-final { scan-tree-dump-times "pr92793-1\\\.c:34:19\\\] #pragma acc loop" 1 "original" { xfail *-*-* } } } */ \
+ /* { dg-final { scan-tree-dump-times "pr92793-1\\\.c:34:19\\\] #pragma acc loop" 1 "gimple" } } */ \
+ reduction ( - : diff ) \
+reduction(-:sum ) /* { dg-line sum2 } */ \
+ /* C location information points to the '(' in 'reduction(-:sum)'. */ \
+ /* { dg-warning "10: conflicting reduction operations for 'sum'" "" { target c } sum2 } */ \
+ /* C++ location information points to 'sum' in 'reduction(-:sum)'. */ \
+ /* { dg-warning "13: conflicting reduction operations for 'sum'" "" { target c++ } sum2 } */ \
+ independent
+ for (j = 1; j <= 10; j++)
+ {
+ sum
+ =
+ 1 ;
+ /* C, C++ location information points to the '=' in 'sum = 1'. */ \
+ /* { dg-final { scan-tree-dump-times "pr92793-1\\\.c:48:19\\\] sum = 1" 1 "original" { xfail *-*-* } } } */ \
+ /* { dg-final { scan-tree-dump-times "pr92793-1\\\.c:48:19\\\] sum = 1" 1 "gimple" } } */
+ }
+ }
+ }
+}
diff --git a/gcc/testsuite/gfortran.dg/goacc/clause-locations.f90 b/gcc/testsuite/gfortran.dg/goacc/clause-locations.f90
deleted file mode 100644
index 29798d31542..00000000000
--- a/gcc/testsuite/gfortran.dg/goacc/clause-locations.f90
+++ /dev/null
@@ -1,18 +0,0 @@
-! 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
-
diff --git a/gcc/testsuite/gfortran.dg/goacc/pr92793-1.f90 b/gcc/testsuite/gfortran.dg/goacc/pr92793-1.f90
new file mode 100644
index 00000000000..a572c6b3437
--- /dev/null
+++ b/gcc/testsuite/gfortran.dg/goacc/pr92793-1.f90
@@ -0,0 +1,47 @@
+! Verify column location information.
+
+! See also 'c-c++-common/goacc/pr92793-1.c'.
+
+! { dg-additional-options "-fdump-tree-original-lineno" }
+! { dg-additional-options "-fdump-tree-gimple-lineno" }
+
+! No tabs. Funny indentation/spacing for a reason.
+
+
+subroutine check ()
+ implicit none (type, external)
+ integer :: i, j, sum, diff
+
+ !$acc parallel &
+ !$acc & & ! Fortran location information points to the last line of the directive, and there is no column location information.
+!$acc && ! { dg-final { scan-tree-dump-times "pr92793-1\\\.f90:18:0\\\] #pragma acc parallel" 1 "original" } }
+ !$acc & ! { dg-final { scan-tree-dump-times "pr92793-1\\\.f90:18:0\\\] #pragma omp target oacc_parallel" 1 "gimple" } }
+ !$acc loop &
+ !$acc & & ! Fortran location information points to the last line of the directive, and there is no column location information.
+ !$acc & & ! { dg-final { scan-tree-dump-times "pr92793-1\\\.f90:26:0\\\] #pragma acc loop" 1 "original" } }
+ !$acc & & ! { dg-final { scan-tree-dump-times "pr92793-1\\\.f90:26:0\\\] #pragma acc loop" 1 "gimple" } }
+ !$acc& reduction ( + : sum ) & ! { dg-line sum1 }
+ !$acc && ! Fortran location information points to the ':' in 'reduction(+:sum)'.
+ !$acc & & ! { dg-message "36: location of the previous reduction for 'sum'" "" { target *-*-* } sum1 }
+!$acc& independent
+ do i = 1, 10
+ !$acc loop &
+!$acc & & ! Fortran location information points to the last line of the directive, and there is no column location information.
+ !$acc & & ! { dg-final { scan-tree-dump-times "pr92793-1\\\.f90:36:0\\\] #pragma acc loop" 1 "original" } }
+ !$acc & & ! { dg-final { scan-tree-dump-times "pr92793-1\\\.f90:36:0\\\] #pragma acc loop" 1 "gimple" } }
+ !$acc & reduction(-: diff ) &
+ !$acc&reduction(- : sum) & ! { dg-line sum2 }
+ !$acc & & ! Fortran location information points to the ':' in 'reduction(-:sum)'.
+ !$acc& & ! { dg-warning "32: conflicting reduction operations for 'sum'" "" { target *-*-* } sum2 }
+ !$acc &independent
+ do j = 1, 10
+ sum &
+ & = &
+ & 1
+ ! Fortran location information points to the last line of the statement, and there is no column location information.
+ ! { dg-final { scan-tree-dump-times "pr92793-1\\\.f90:40:0\\\] sum = 1" 1 "original" } }
+ ! { dg-final { scan-tree-dump-times "pr92793-1\\\.f90:40:0\\\] sum = 1" 1 "gimple" } }
+ end do
+ end do
+!$acc end parallel
+end subroutine check
More information about the Gcc-cvs
mailing list