This is the mail archive of the gcc-bugs@gcc.gnu.org mailing list for the GCC project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

[Bug fortran/42131] Weird translation of DO loops



------- Comment #1 from kargl at gcc dot gnu dot org  2009-11-21 16:26 -------
(In reply to comment #0)

> To illustrate this with a simple example:
> 
> DO I = M1, M2, M3
>    B(I) = A(I)
> ENDDO
> 
> would be most easily, and atraightforwardly, implemented as follows:
> 
>      IF (M3 > 0 .AND. M1 < M2) GOTO 200  ! Loop executed zero times
>      IF (M3 < 0 .AND. M1 > M2) GOTO 200  ! Ditto

First, I just woke up 10 minutes ago and still have 1/2 of cup of coffee,
but the logic above looks wrong.

do i = 1, 2, 1
   print *, i
end do

should produce
1
2

Here, we have m1 = 1, m2 = 2, m3 = 1

>      IF (M3 > 0 .AND. M1 < M2) GOTO 200  ! Loop executed zero times


-- 


http://gcc.gnu.org/bugzilla/show_bug.cgi?id=42131


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]