On 2012-02-27 3:36 PM,
robert....@oracle.com wrote:
...
> I realized soon after posting my first response that your example
> did not show the case I thought it did. There does appear to be
> an ambiguity.
Apologies for that - we crossed posts. The example was rather obscure too.
Here's another case:
MODULE AUnaryAndBinaryOp
IMPLICIT NONE
PRIVATE
PUBLIC :: OPERATOR(.op.)
INTERFACE OPERATOR(.op.)
PROCEDURE unary_op
PROCEDURE binary_op
END INTERFACE OPERATOR(.op.)
REAL, TARGET, PUBLIC :: blue
REAL, TARGET, PUBLIC :: green
CONTAINS
FUNCTION unary_op(arg) RESULT(ptr)
INTEGER, INTENT(IN) :: arg
REAL, POINTER :: ptr
ptr => blue
END FUNCTION unary_op
FUNCTION binary_op(lhs, rhs) RESULT(ptr)
INTEGER, INTENT(IN) :: lhs
INTEGER, INTENT(IN) :: rhs
REAL, POINTER :: ptr
ptr => green
END FUNCTION binary_op
END MODULE MODULE AUnaryAndBinaryOp
PROGRAM AmbiguousAssignment
USE AUnaryAndBinaryOp
IMPLICIT NONE
!*************************************
blue = 1.0
green = 2.0
! What does this do? Is 10 a label
! or an operand?
10 .op. 20 = 5.0
PRINT *, blue, green
END PROGRAM AmbiguousAssignment
The previous example was (I think) valid F2003, with F2008 adding a
possible alternative interpretation. I presume in those circumstances
the existing F90+ interpretation would have precedence?
In this case both possibilities require F2008. Is this one of those
cases where the standard "fails to establish an interpretation" and so
program and processor behaviour is formally undefined?