gcc/libgomp/testsuite/libgomp.oacc-fortran/parallel-reduction.f90
Tobias Burnus bd7ebe9da7 OpenACC: Fix pattern in dg-bogus in Fortran testcases again
It turned out that a compiler built without offloading support
and one with can produce slightly different diagnostic.

Offloading support implies ENABLE_OFFLOAD which implies that
g->have_offload is set when offloading is actually needed.
In cgraphunit.c, the latter causes flag_generate_offload = 1,
which in turn affects tree.c's free_lang_data.

The result is that the front-end specific diagnostic gets reset
('tree_diagnostics_defaults (global_dc)'), which affects in this
case 'Warning' vs. 'warning' via the Fortran frontend.

Result: 'Warning:' vs. 'warning:'.
Side note: Other FE also override the diagnostic, leading to
similar differences, e.g. the C++ FE outputs mangled function
names differently, cf. patch thread.

libgomp/ChangeLog:

	* testsuite/libgomp.oacc-fortran/par-reduction-2-1.f:
	Use [Ww]arning in dg-bogus as FE diagnostic and default
	diagnostic differ and the result depends on ENABLE_OFFLOAD.
	* testsuite/libgomp.oacc-fortran/par-reduction-2-2.f: Likewise.
	* testsuite/libgomp.oacc-fortran/parallel-dims.f90: Likewise.
	* testsuite/libgomp.oacc-fortran/parallel-reduction.f90: Likewise.

gcc/testsuite/ChangeLog:

	* gfortran.dg/goacc/classify-serial.f95:
	Use [Ww]arning in dg-bogus as FE diagnostic and default
	diagnostic differ and the result depends on ENABLE_OFFLOAD.
	* gfortran.dg/goacc/kernels-decompose-2.f95: Likewise.
	* gfortran.dg/goacc/routine-module-mod-1.f90: Likewise.
2021-04-26 23:13:22 +02:00

52 lines
1.2 KiB
Fortran

! { dg-do run }
! { dg-additional-options "-Wopenacc-parallelism" } for testing/documenting
! aspects of that functionality.
program reduction
implicit none
integer, parameter :: n = 10
integer s1, s2
include "openacc_lib.h"
s1 = 0
s2 = 0
!$acc parallel reduction(+:s1,s2) num_gangs (n) copy(s1)
! { dg-bogus "\[Ww\]arning: region is gang partitioned but does not contain gang partitioned code" "TODO 'reduction'" { xfail *-*-* } .-1 }
s1 = s1 + 1
s2 = s2 + 1
!$acc end parallel
if (acc_get_device_type () .ne. acc_device_host) then
if (s1 .ne. n) STOP 1
if (s2 .ne. n) STOP 2
else
if (s1 .ne. 1) STOP 3
if (s2 .ne. 1) STOP 4
end if
! Test reductions inside subroutines
s1 = 0
s2 = 0
call redsub (s1, s2, n)
if (acc_get_device_type () .ne. acc_device_host) then
if (s1 .ne. n) STOP 5
else
if (s2 .ne. 1) STOP 6
end if
end program reduction
subroutine redsub(s1, s2, n)
implicit none
integer :: s1, s2, n
!$acc parallel reduction(+:s1,s2) num_gangs (10) copy(s1)
! { dg-bogus "\[Ww\]arning: region is gang partitioned but does not contain gang partitioned code" "TODO 'reduction'" { xfail *-*-* } .-1 }
s1 = s1 + 1
s2 = s2 + 1
!$acc end parallel
end subroutine redsub