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.
+++ /dev/null
-/* 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;
- }
- }
-}
--- /dev/null
+/* 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" } } */
+ }
+ }
+ }
+}
+++ /dev/null
-! 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
-
--- /dev/null
+! 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