IF (logical_expr) IF(arith_expr)n1, n2, n3 in ODEPACK

File www.netlib.org/odepack/opkda2.f contains old versions of some BLAS routines. In it, we can see three instances of a disallowed IF (logical_expression) executable_statement:

S:\LANG>grep -in " if .* if " opkda2.f
630:      IF (INCX .EQ. INCY) IF (INCX-1) 5,20,60
719:      IF (INCX .EQ. INCY) IF (INCX-1) 5,20,60
812:      IF (INCX .EQ. INCY) IF (INCX-1) 5,20,60

According to the Fortran 66 standard, section 7.1.2.3, the executable statement S in
IF (e) S is not allowed to be itself an IF statement or a DO statement. Yet current compilers accept the disallowed combination, unless a compiler flag causes the arithmetic IF to be flagged as obsolescent.

Why is the statement accepted, can anyone tell? Thanks.

Not quite. It states that it may not be another logical IF statement, but here you have an arithmetic IF statement, which is allowed.

HTH

Mike

2 Likes

Ah, I see! Thanks.