Hello,
I'm trying to compile code originally written for intel ifort compiler with gfortan, and I've come across an error that I was able to reproduce with the following small program:
Compiling gives:
So the compiler knows that the contents of the loop will never be executed, but it fails to realize that this also means the divide by zero can never occur.
Does anyone know a way to resolve this? Again, this is just to show the error, this program is pointless on its own but I get the error in my real project.
Thanks a lot!
I'm trying to compile code originally written for intel ifort compiler with gfortan, and I've come across an error that I was able to reproduce with the following small program:
Code:
program testdivzero
implicit none
integer a,b
parameter (b=0)
do a=1,b
write(*,*) 0.5/real(b)
end do
end program testdivzero
Compiling gives:
Code:
gfortran -c testdivzero.F
testdivzero.F:8.22:
write(*,*) 0.5/real(b)
1
Error: Division by zero at (1)
testdivzero.F:7.72:
do a=1,b
1
Warning: DO loop at (1) will be executed zero times
So the compiler knows that the contents of the loop will never be executed, but it fails to realize that this also means the divide by zero can never occur.
Does anyone know a way to resolve this? Again, this is just to show the error, this program is pointless on its own but I get the error in my real project.
Thanks a lot!