Fix warnings occured during profiledboostrap on
[official-gcc.git] / gcc / testsuite / gfortran.dg / pr64530.f90
blob9805f628c8351796247994582c1ac2a5cee12f86
1 ! { dg-do run }
3 program bug
4 ! Bug triggered with at least three elements
5 integer, parameter :: asize = 3
7 double precision,save :: ave(asize)
8 double precision,save :: old(asize)
9 double precision,save :: tmp(asize)
11 ave(:) = 10.d0
12 old(:) = 3.d0
13 tmp(:) = 0.d0
15 call buggy(2.d0,asize,ave,old,tmp)
16 if (any (tmp(:) .ne. 3.5)) call abort
17 end
19 subroutine buggy(scale_factor, asize, ave, old, tmp)
21 implicit none
22 ! Args
23 double precision scale_factor
24 integer asize
25 double precision ave(asize)
26 double precision old(asize)
27 double precision tmp(asize)
29 ! Local
30 integer i
32 do i = 1, asize
33 tmp(i) = ave(i) - old(i)
34 old(i) = ave(i)
35 tmp(i) = tmp(i) / scale_factor
36 end do
38 end subroutine buggy