2017-12-08 Richard Biener <rguenther@suse.de>
[official-gcc.git] / gcc / testsuite / gfortran.dg / actual_array_constructor_3.f90
blob5b0d28a0d023022d9e61d00c68290089edf35fea
1 ! { dg-do run }
2 ! Tests the fix for pr28914, in which array constructors using the loop
3 ! variable within a do loop for the implied do loop of the constructor
4 ! would result in a corrupted do loop counter.
6 ! Based on the testscase by Ed Korkven <kornkven@arsc.edu>
8 program pr28914
9 implicit none
10 integer n, i
11 parameter (n = 66000) ! Problem manifests for n > 65535
12 double precision a(n), summation
14 summation = 0.0
15 do i = 1, 1
16 a = (/ (i, i = 1, n) /) ! This is legal and was broken
17 a = sqrt(a)
18 summation = SUM(a)
19 enddo
20 summation = abs(summation - 11303932.9138271_8)
22 if (summation.gt.0.00001) call abort()
23 end program pr28914