This is the mail archive of the
fortran@gcc.gnu.org
mailing list for the GNU Fortran project.
Re: REAL DO loop iterator question
On Sat, Nov 27, 2004 at 11:34:30PM +0100, Steven Bosscher wrote:
> On Saturday 27 November 2004 21:16, Steve Kargl wrote:
> > On Sat, Nov 27, 2004 at 09:07:50PM +0100, Steven Bosscher wrote:
> > > On Nov 27, 2004 07:04 PM, Steve Kargl <sgk@troutmask.apl.washington.edu>
> wrote:
> > > > Gang,
> > > >
> > > > In trans-stmt.c, we translate the DO loop block into
> > > > the tree-ssa representation. Currently, it only
> > > > permits an INTEGER iterator.
> > >
> > > That's because REAL itetators are not valid.
> >
> > See PR 16222 and any version of g77.
>
> Yeah, I'm aware of the PR. Oh well, we do want g77 compatibility
> I suppose. This is why Fortran is now so complex - because it is
> hard to get a feature deleted, and when something that stinks is
> finally removed, most compilers decide to support it anyway! :-)
>
> The proper way to support this is to only initialize the start
> and step values of the REAL-typed iterator, and use an integer
> loop iterator in the generated loop. Just pre-compute the number
> of loop iterations and use a decrement-and-test to construct the
> actual loop. For example, your program from PR16222 would look
> something like this:
>
I have a patch that actually appears to work.
I current need to decide if I want to hide
a warning behind an option.
if (gfc_option.warn_surprising && iter->var->ts.type == BT_REAL)
gfc_warning ("REAL DO loop iterator at %L", &iter->var->where);
--
Steve