| 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. |
| 5 |
! |
| 6 |
! Based on the testscase by Ed Korkven <[email protected]> |
| 7 |
! |
| 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 |
| 13 |
|
| 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) |
| 21 |
|
| 22 |
if (summation.gt.0.00001) STOP 1 |
| 23 |
end program pr28914 |
| 24 |
|
| 25 |
|