[PATCH 0/2, fortran] Better code generation for DO loops with +-1 step
Jakub Jelinek
jakub@redhat.com
Fri Jul 8 09:05:00 GMT 2016
On Fri, Jul 08, 2016 at 11:03:35AM +0200, Jan Hubicka wrote:
> > On Fri, Jul 08, 2016 at 10:33:45AM +0200, Martin Liška wrote:
> > > On 07/07/2016 04:40 PM, Jan Hubicka wrote:
> > > >>
> > > >> Why is the behavior only undefined for step 1 if the last iteration IV
> > > >> increment overflows?
> > > >> Doesn't this apply to all step values?
> > > >
> > > > This is what Fortran standard says:
> > > >
> > > > The iteration count is established and is the value of the expression (m2-m1+m3)/m3 unless that value is negative,
> > > > in which case the iteration count is 0.
> > > >
> > > > My reading of this is that the do statement is undefined whenever the expression above is undefined
> > > > (m1 is lower bound, m2 is upper bound, m3 is step) and because I think the evaulation order of
> > > > m2-m1+m3 is not fixed, I think the statement is not defined whethever (m2-m1), (m1+m3) or (m2-m1)+m3
> >
> > m1+m3? Did you mean m3-m1 or -m1+m3 instead?
>
> Ah yes, -m1+m3. But I am by no means language expert - this was meant as a heads up to Fortran
> people :)
Heads up to Fortran people should be sent to fortran@gcc.gnu.org ;)
Jakub
More information about the Fortran
mailing list