[Bug fortran/44354] incorrect output at run time

2010-06-01 Thread burnus at gcc dot gnu dot org
--- Comment #18 from burnus at gcc dot gnu dot org 2010-06-01 08:03 --- Just for fun, I have feed it into NAG's f95 - and it prints: Extension: gjff.f90, line 2: AC-implied-DO limit references control variable I $ ./a.out 1 2 3 4 5 Where extension = vendor extension. (NAG also uses

[Bug fortran/44354] incorrect output at run time

2010-06-01 Thread mikael at gcc dot gnu dot org
--- Comment #19 from mikael at gcc dot gnu dot org 2010-06-01 14:09 --- Created an attachment (id=20795) -- (http://gcc.gnu.org/bugzilla/attachment.cgi?id=20795action=view) Draft patch, version 2 Also pre-evaluate the lower bound. for a case like this : integer j(4) I=5

[Bug fortran/44354] incorrect output at run time

2010-06-01 Thread mikael at gcc dot gnu dot org
--- Comment #20 from mikael at gcc dot gnu dot org 2010-06-01 14:13 --- (In reply to comment #19) for a case like this : integer j(4) I=5 j = (/(i,i=I-1,8)/) You should read here : j = (/(i,i=I,8)/) end --

[Bug fortran/44354] incorrect output at run time

2010-06-01 Thread dfranke at gcc dot gnu dot org
--- Comment #21 from dfranke at gcc dot gnu dot org 2010-06-01 21:02 --- (In reply to comment #18) Expected: a) Allow it as extension (-std=gnu or -std=legacy; especially, for -std=gnu one could consider a default-enabled warning) b) Reject it for -std=f(95,2003,2008) I'd vote

[Bug fortran/44354] incorrect output at run time

2010-05-31 Thread mikael at gcc dot gnu dot org
--- Comment #1 from mikael at gcc dot gnu dot org 2010-05-31 17:43 --- Note that fortran is case insensitive, ie i and I refer to the same variable. -- http://gcc.gnu.org/bugzilla/show_bug.cgi?id=44354

[Bug fortran/44354] incorrect output at run time

2010-05-31 Thread dominiq at lps dot ens dot fr
--- Comment #2 from dominiq at lps dot ens dot fr 2010-05-31 18:01 --- Note that fortran is case insensitive, ... Indeed, but I think the implied do loop should still go from 1 to 5. Note that if I print 'i' after the loop I get 5. --

[Bug fortran/44354] incorrect output at run time

2010-05-31 Thread mikael at gcc dot gnu dot org
--- Comment #3 from mikael at gcc dot gnu dot org 2010-05-31 18:04 --- OK, it seems gfortran is wrong here. The 4.8 section (Construction of array values) says : /If an ac-value is an ac-implied-do, it is expanded to form a sequence of elements under the control of the

[Bug fortran/44354] incorrect output at run time

2010-05-31 Thread kargl at gcc dot gnu dot org
--- Comment #4 from kargl at gcc dot gnu dot org 2010-05-31 18:33 --- (In reply to comment #2) Note that fortran is case insensitive, ... Indeed, but I think the implied do loop should still go from 1 to 5. Note that if I print 'i' after the loop I get 5. Of course it prints

[Bug fortran/44354] incorrect output at run time

2010-05-31 Thread dominiq at lps dot ens dot fr
--- Comment #5 from dominiq at lps dot ens dot fr 2010-05-31 19:24 --- The question becomes whether the 'I' in the implied-do-loop is being used uninitialized. From comment #3, I think the 'i' in i,i= should not be the same as the 'i' in =1,i. Confirmed. However, having this in

[Bug fortran/44354] incorrect output at run time

2010-05-31 Thread kargl at gcc dot gnu dot org
--- Comment #6 from kargl at gcc dot gnu dot org 2010-05-31 20:02 --- (In reply to comment #5) The question becomes whether the 'I' in the implied-do-loop is being used uninitialized. From comment #3, I think the 'i' in i,i= should not be the same as the 'i' in =1,i. Well, it

[Bug fortran/44354] incorrect output at run time

2010-05-31 Thread mikael at gcc dot gnu dot org
--- Comment #7 from mikael at gcc dot gnu dot org 2010-05-31 21:31 --- (In reply to comment #6) because in the above 'i' and 'I' are in the same scoping unit. I couldn't find what mandates in the standard that i and I are in a different scoping unit/are different variables. Are they ?

[Bug fortran/44354] incorrect output at run time

2010-05-31 Thread mikael at gcc dot gnu dot org
--- Comment #8 from mikael at gcc dot gnu dot org 2010-05-31 21:33 --- Created an attachment (id=20787) -- (http://gcc.gnu.org/bugzilla/attachment.cgi?id=20787action=view) draft patch This makes loop bounds evaluation before the internal variable substitution. --

[Bug fortran/44354] incorrect output at run time

2010-05-31 Thread zeccav at gmail dot com
--- Comment #9 from zeccav at gmail dot com 2010-05-31 21:37 --- Subject: Re: incorrect output at run time In my example 'i' is local to the array constructor, while 'I' is global and is initialized with value 5, so that the statement should display '1 2 3 4 5'. I agree that this is a

[Bug fortran/44354] incorrect output at run time

2010-05-31 Thread mikael at gcc dot gnu dot org
--- Comment #10 from mikael at gcc dot gnu dot org 2010-05-31 21:39 --- (In reply to comment #6) integer j(5) I=5 j = 42 do i = 1, I j(i) = i end do print '(A,I0,A,5(I0,1X))', 'I = ', I, ' j = ', j end because in the above

[Bug fortran/44354] incorrect output at run time

2010-05-31 Thread kargl at gcc dot gnu dot org
--- Comment #11 from kargl at gcc dot gnu dot org 2010-05-31 21:54 --- (In reply to comment #7) (In reply to comment #6) because in the above 'i' and 'I' are in the same scoping unit. I couldn't find what mandates in the standard that i and I are in a different scoping unit/are

[Bug fortran/44354] incorrect output at run time

2010-05-31 Thread kargl at gcc dot gnu dot org
--- Comment #12 from kargl at gcc dot gnu dot org 2010-05-31 22:47 --- (In reply to comment #8) Created an attachment (id=20787) -- (http://gcc.gnu.org/bugzilla/attachment.cgi?id=20787action=view) [edit] draft patch This makes loop bounds evaluation before the internal variable

[Bug fortran/44354] incorrect output at run time

2010-05-31 Thread kargl at gcc dot gnu dot org
--- Comment #13 from kargl at gcc dot gnu dot org 2010-05-31 23:44 --- Due to my confusion over the scope of 'i' and 'I', I posted to c.l.f. As usual Richard Maine pieced through the standard's language.

[Bug fortran/44354] incorrect output at run time

2010-05-31 Thread jvdelisle at gcc dot gnu dot org
--- Comment #14 from jvdelisle at gcc dot gnu dot org 2010-06-01 02:09 --- My take on this as I was reading through this thread before I got to comment #13 is that the code has to be illegal. I vote for the error. I think it would be bad practice too introduce this as an extension or

[Bug fortran/44354] incorrect output at run time

2010-05-31 Thread sgk at troutmask dot apl dot washington dot edu
--- Comment #15 from sgk at troutmask dot apl dot washington dot edu 2010-06-01 03:07 --- Subject: Re: incorrect output at run time On Tue, Jun 01, 2010 at 02:09:38AM -, jvdelisle at gcc dot gnu dot org wrote: My take on this as I was reading through this thread before I got

[Bug fortran/44354] incorrect output at run time

2010-05-31 Thread jvdelisle at verizon dot net
--- Comment #16 from jvdelisle at verizon dot net 2010-06-01 03:46 --- Subject: Re: incorrect output at run time On 05/31/2010 08:07 PM, sgk at troutmask dot apl dot washington dot edu wrote: --- Comment #15 from sgk at troutmask dot apl dot washington dot edu 2010-06-01 03:07

[Bug fortran/44354] incorrect output at run time

2010-05-31 Thread pault at gcc dot gnu dot org
--- Comment #17 from pault at gcc dot gnu dot org 2010-06-01 04:31 --- (In reply to comment #13) Due to my confusion over the scope of 'i' and 'I', I posted to c.l.f. As usual Richard Maine pieced through the standard's language.