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

            Bug ID: 57628
           Summary: spurious error: division by zero in if statement
           Product: gcc
           Version: 4.7.3
            Status: UNCONFIRMED
          Severity: normal
          Priority: P3
         Component: fortran
          Assignee: unassigned at gcc dot gnu.org
          Reporter: furue at hawaii dot edu

Dear gfortran maintainers,

Division by zero causes error even when it's not executed:

program try
  implicit NONE
  real, parameter:: a = 0.0
  if (a > 0) then
    write(*,*) 1/a
  end if
end program try

$ /usr/bin/gfortran tmp.f90
tmp.f90:5.16:

    write(*,*) 1/a
                1
Error: Division by zero at (1)
$

If it's difficult to give a correct diagnosis, please demote this to a warning.

I have a lot of constructs like this because I change the parameter often and
so this behavior of gfortran is very inconvenient (because I have to rewrite my
source code to be able to compile it).

Regards,
Ryo

Reply via email to