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

            Bug ID: 58100
           Summary: Spurious "DO loop at (1) will be executed zero times"
                    warning
           Product: gcc
           Version: 4.8.0
            Status: UNCONFIRMED
          Severity: normal
          Priority: P3
         Component: fortran
          Assignee: unassigned at gcc dot gnu.org
          Reporter: roland.kaufmann at uni dot no

Minimum example to reproduce:

    program doloop
    integer, parameter :: i = 0
    if (i <= 0) then
       print *,'i is not positive'
    else
       do j=1,i
          print *,'Hello, World!'
       end do
    end if
    end program doloop

If I compile with:

    gfortran doloop.f90

I get the output:

    doloop.f90:6.15:

           do j=1,i
                   1
    Warning: DO loop at (1) will be executed zero times

which of course is correct, but should not be a warning since it is in the else
clause.

Reply via email to