[Bug fortran/45624] Division by zero compiler error
dominiq at lps dot ens dot fr
gcc-bugzilla@gcc.gnu.org
Thu Sep 9 23:20:00 GMT 2010
------- Comment #4 from dominiq at lps dot ens dot fr 2010-09-09 23:20 -------
You can use the option -fno-range-check. However, the code itself and the
sentence "since I want to protect this variable" in comment #3 let me suspect
that you have not understood what PARAMETER is for: a variable with the
PARAMETER "attribute" is an alias for its value and exists only during the
compilation.
What you seem to want is the attribute PROTECTED, i.e. a variable that can be
changed only in a specified place as in (F2003 standard draft):
An example of the PROTECTED attribute:
MODULE temperature
REAL, PROTECTED :: temp_c, temp_f
CONTAINS
SUBROUTINE set_temperature_c(c)
REAL, INTENT(IN) :: c
temp_c = c
temp_f = temp_c*(9.0/5.0) + 32
END SUBROUTINE
END MODULE
The PROTECTED attribute ensures that the variables temp_c and temp_f cannot be
modied other than
via the set_temperature_c procedure, thus keeping them consistent with each
other.
The PROTECTED attribute is a f2003 addition, implemented at least from gfortran
4.4.
--
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=45624
More information about the Gcc-bugs
mailing list