[PATCH,gfortran] Fix PR 16222
Steve Kargl
sgk@troutmask.apl.washington.edu
Sat Dec 4 16:56:00 GMT 2004
On Wed, Dec 01, 2004 at 09:22:51PM +0000, Paul Brook wrote:
> On Sunday 28 November 2004 00:51, Steve Kargl wrote:
> > The attached patch fixes PR 16222. Bootstrapped
> > and regression tested on i386-unknown-freebsd6.0.
> >
> > 2004-11-24 Steven G. Kargl <kargls@comcast.net>
> >
> > PR 16222
> > * gfortran.h (gfc_resolve_do_iterator): Add prototype
> > * resolve.c (gfc_resolve_do_iterator): New function; use it
> > * trans-stmt.c (gfc_trans_do): Allow REAL iterator
>
> Duplicating gfc_resolve_iterator seems a bad idea.
After playing with my patch, I agree a duplication of
gfc_resolve_iterator is a bad idea.
>
> Are you deliberately allowing a mixture of integer and real types?
>
Not intentionally. It seems the parsing of iterator's to, from, and
step, and the use of these in assignment of the loop variable don't
follow the normal promotion rules of Fortran. For example, with my
patch all of the following loops work
real :: x = 0., y = 1., z = 0.1
real a
! do a = x, y, z
! do a = x, y, 0.1
! do a = x, 1., 0.1
! do a = x, 1, 0.1 ! y replaced by integer 1
! do a = 0., y, 0.1
! do a = 0, y, 0.1 ! x replaced by integer 0
! do a = 0., 1., z
! do a = 0, 1., z ! x replaced by integer 0
! do a = 0., 1, z ! y replaced by integer 1
! do a = 0, 1, z ! x and y integer
end do
These loops cause a problem
! do a = 0, 1, 0.1
! do a = 0, 1., 0.1
! do a = 0., 1, 0.1
! do a = 0., 1., 0.1
end do
do3.f: In function 'MAIN__':
do3.f:5: internal compiler error: in real_arithmetic, at real.c:1034
Please submit a full bug report,
with preprocessed source if appropriate.
--
Steve
More information about the Fortran
mailing list