[Bug fortran/45624] Division by zero compiler error
leftynm at umich dot edu
gcc-bugzilla@gcc.gnu.org
Fri Sep 10 16:06:00 GMT 2010
------- Comment #5 from leftynm at umich dot edu 2010-09-10 16:06 -------
Thanks guys. Yeah, I guess my use of PARAMETER wasn't consistent with how it
works. I was using it to set a variable such that it cannot be changed. I
found a work around though lets me keep it as a PARAMETER, but allows me to
compile.
PROGRAM test
IMPLICIT NONE
REAL*8, PARAMETER :: alpha = 0.D0
REAL*8, DIMENSION(5,5) :: matrix
INTEGER :: i
REAL*8 :: dummy
matrix = 0.D0
DO i=1,5
IF (alpha == 0.D0) THEN
matrix(i,i) = 0.D0
ELSE
dummy = alpha
matrix(i,i) = 1.D0/dummy
ENDIF
ENDDO
END PROGRAM
This is what I need, since when I don't make my variable a PARAMETER, it causes
other problems. This requires less work to fix, so I'm happy with it. I tried
PROTECTED, but my code has to be F90 because it's a small part of a bigger
project.
Thanks to everyone though. I wouldn't have figured this out without your
inputs.
--
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=45624
More information about the Gcc-bugs
mailing list