Interesting story about logicals and integers.
Since logical is a data type, some think
- true is 1 and false is zero.
- false is zero, true is everything else.
and Fortran does not specifically describe the conversion
from logical to integer.
Here are the switches PGI has defined.
directs the compiler to treat logical values as true if the value is non-zero and false
if the value is zero (UNIX F77 convention). When -Munixlogical is enabled, a logical
value or test that is non-zero is .TRUE., and a value or test that is zero is .FALSE… In
addition, the value of a logical expression is guaranteed to be one (1) when the result
directs the compiler to use the VMS convention for logical values for true and false.
Even values are true and odd values are false.
I think you need to add
to your compilation.
Others will tell you that you should use ‘transfer’ to convert from
logical to integer, as in
logical :: a
integer :: i,j