------- 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 still comes back to scope. The implied-do-loop is different from 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 'i' and 'I' are in the same scoping unit. If you write 'i = 5; j = [(i,i=1,I)]' then the 'i' here is in a different scoping unit. I agree that the scalar-int-expr '1' and 'I' need to be evaluated to establish the the loop start and stop values. The question again based on scoping unit is whether 'I' is uninitialized. > > Confirmed. However, having this in real world codes seems like the best way > > to > > confuse people. > > Agreed!-) I am always baffled by the users' talent to make their life > miserable. > Nevertheless the compiler should follow the standard, i.e., from my > understanding of the construct, print the 1 to 5 sequence. > -- http://gcc.gnu.org/bugzilla/show_bug.cgi?id=44354