and Fortran does not specifically describe the conversion
from logical to integer.
Here are the switches PGI has defined.
-Munixlogical
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
is .TRUE…
-Mnounixlogical
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
-Munixlogical
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
i=99
a=transfer(i,a)
j=transfer(a,j)