Skip to content
Snippets Groups Projects
Commit fa410314 authored by Thomas Schwinge's avatar Thomas Schwinge
Browse files

[OpenACC] Elaborate testcases that verify column location information [PR92793]

After PR92793 commit 9c81750c "Fortran] PR
92793 - fix column used for error diagnostic", commit
d0d0ba20 did "Add tests to verify OpenACC
clause locations", later fixed up in PR92901 commit
e6c90dba 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.
parent 63d0da88
No related branches found
No related tags found
No related merge requests found
/* 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;
}
}
}
/* 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" } } */
}
}
}
}
! 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
! 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
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment