gcc/libgomp/testsuite/libgomp.fortran/pr100981-2.f90
Jakub Jelinek 7d19a50ea1 testsuite: Fix up libgomp.fortran/pr100981-2.f90 testcase [PR100981]
The dsdotr and dsdoti variables uninitialized and the testcase fails e.g.
on i686-linux.  Fixed by zero initialization.

2021-06-10  Jakub Jelinek  <jakub@redhat.com>

	PR tree-optimization/100981
	* testsuite/libgomp.fortran/pr100981-2.f90 (cdcdot): Initialize
	dsdotr and dsdoti to 0.
2021-06-10 09:31:06 +02:00

34 lines
741 B
Fortran

! { dg-do run }
! { dg-additional-options "-O3 -ftree-parallelize-loops=2 -fno-signed-zeros -fno-trapping-math" }
complex function cdcdot(n, cx)
implicit none
integer :: n, i, kx
complex :: cx(*)
double precision :: dsdotr, dsdoti, dt1, dt3
kx = 1
dsdotr = 0
dsdoti = 0
do i = 1, n
dt1 = real(cx(kx))
dt3 = aimag(cx(kx))
dsdotr = dsdotr + dt1 * 2 - dt3 * 2
dsdoti = dsdoti + dt1 * 2 + dt3 * 2
kx = kx + 1
end do
cdcdot = cmplx(real(dsdotr), real(dsdoti))
return
end function cdcdot
program test
implicit none
complex :: cx(100), ct, cdcdot
integer :: i
do i = 1, 100
cx(i) = cmplx(2*i, i)
end do
ct = cdcdot (100, cx)
if (ct.ne.cmplx(10100.0000,30300.0000)) call abort
end