Odd bug from Stack Overflow
Steve Kargl
sgk@troutmask.apl.washington.edu
Sun Mar 18 17:19:00 GMT 2018
On Sun, Mar 18, 2018 at 06:12:23PM +0100, Thomas König wrote:
> Hi Steve,
>
> This looks like a missing conversion somewhere,
> because this works:
>
> program test
> implicit none
> integer, parameter :: n = 65536
> real, dimension(n) :: y
> integer :: i
> y = (/ (1.0, i=1, n) /)
> print *,y(2)
> if (y(2) /= 1) stop 1
> end program test
>
> Also, n=65536 is a limit... setting n=2**16-1 actually
> works as expected with the orginal test case.
Yes, n=2**16-1 works because gfortran switches over from
expanding the array constructor into a static temporary
variable to scalarizing the implied-do-loop at 2**16. It
is a trade-off we made a long time ago for
integer, parameter :: i(somebignumber) = [(i,i=1,somebignumer)]
See -fmax-array-constructor= option.
> This looks like a resolution problem, not something
> in the scalarizer. Can you open a PR?
Yes.
--
Steve
More information about the Fortran
mailing list