Re: [PATCH 0/2, fortran] Better code generation for DO loops with +-1 step

2016-07-08 Thread FX
> 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 when

Re: [PATCH 0/2, fortran] Better code generation for DO loops with +-1 step

2016-07-08 Thread Jakub Jelinek
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? > >

Re: [PATCH 0/2, fortran] Better code generation for DO loops with +-1 step

2016-07-08 Thread Jan Hubicka
> 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 For

Re: [PATCH 0/2, fortran] Better code generation for DO loops with +-1 step

2016-07-08 Thread Jakub Jelinek
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 sa

Re: [PATCH 0/2, fortran] Better code generation for DO loops with +-1 step

2016-07-08 Thread Martin Liška
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 expres

Re: [PATCH 0/2, fortran] Better code generation for DO loops with +-1 step

2016-07-07 Thread Jan Hubicka
> > 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, i

Re: [PATCH 0/2, fortran] Better code generation for DO loops with +-1 step

2016-07-07 Thread Richard Biener
On Thu, Jul 7, 2016 at 11:32 AM, marxin wrote: > Hello. > > As discussed in [1], I would like to change code emission from: > > D.3428 = (*array)[0]; > D.3429 = (*array)[1]; > i = D.3428; > if (i <= D.3429) > { > while (1) > { > { >

[PATCH 0/2, fortran] Better code generation for DO loops with +-1 step

2016-07-07 Thread marxin
Hello. As discussed in [1], I would like to change code emission from: D.3428 = (*array)[0]; D.3429 = (*array)[1]; i = D.3428; if (i <= D.3429) { while (1) { { logical(kind=4) D.3432; (*block)[(integer(kind=8)) i + -