A Fortran DO loop does not terminate if the loop variable is changed
inside of the loop to a value higher than the implied limit.

Please find below a small example which shows this behavior.


      program main
      integer  LOOP
      do LOOP=1,3
         print *,' LOOP = ',LOOP,' < 3'
         CALL B (LOOP)
         print *,'LOOP is now ',LOOP
      end do
      end

      SUBROUTINE B(LOOP)
      INTEGER LOOP
      if (LOOP > 10) then
         LOOP = 1
      else
         LOOP = LOOP + 1
      endif
      END


-- 
           Summary: Bad test on do loop limit
           Product: gcc
           Version: 4.1.2
            Status: UNCONFIRMED
          Severity: major
          Priority: P3
         Component: fortran
        AssignedTo: unassigned at gcc dot gnu dot org
        ReportedBy: manz at intes dot de


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

Reply via email to