debugging - segmentation fault created by fortran if tests -
suppose have following code
if (a.eq.0.or.m(a))
with integer , m(1:3) array of logicals. if equal 0, expect first test catch , second 1 never evaluated. however, if use intel fortran compiler , compiles with
-check
then got segmentation fault. no error occurs without debugging option. standard behavior? many languages said explicitly in manual for
if (a.or.b)
if true b not evaluated. fortran standard explicitly requires , b can evaluated if not impact final result?
fortran allows for, but not guarantee, short-circuit evaluation of logical operators. safe, have write code under assumption each operand evaluated.
Comments
Post a Comment