https://gcc.gnu.org/bugzilla/show_bug.cgi?id=62106
Bug ID: 62106
Summary: Adding a scalar variable to an array constructor gives
wrong result
Product: gcc
Version: 4.9.2
Status: UNCONFIRMED
Severity: major
Priority: P3
Component: fortran
Assignee: unassigned at gcc dot gnu.org
Reporter: m.a.hulsen at tue dot nl
The following code
program t
integer :: ndim=2, ndfp=4, i
print *, (/ ( i, i = 1, ndfp ) /) + ndim
end program t
gives
1 2 3 4
whereas it should be
3 4 5 6
Note, that both ndfp and ndim need to be variables not constants, in order to
generate the wrong result.