This is the mail archive of the
gcc-bugs@gcc.gnu.org
mailing list for the GCC project.
[Bug fortran/42131] Weird translation of DO loops
- From: "kargl at gcc dot gnu dot org" <gcc-bugzilla at gcc dot gnu dot org>
- To: gcc-bugs at gcc dot gnu dot org
- Date: 21 Nov 2009 16:26:31 -0000
- Subject: [Bug fortran/42131] Weird translation of DO loops
- References: <bug-42131-10053@http.gcc.gnu.org/bugzilla/>
- Reply-to: gcc-bugzilla at gcc dot gnu dot org
------- 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