To: J3 J3/12-149 Subject: Interpretation concerning L-value functions From: Van Snyder Date: 2012 May 16 ---------------------------------------------------------------------- NUMBER: TBD TITLE: L-value functions in assignment KEYWORDS: L-value functions, pointer, assignment, defined operators DEFECT TYPE: Erratum STATUS: J3 consideration in progress QUESTION: Consider the following module Funcs interface operator ( .op. ) module procedure Unary, Binary end interface contains function Unary ( Arg ) integer, intent(in) :: Arg integer, pointer :: Unary ... end function Unary function Binary ( Arg1, Arg2 ) integer, intent(in) :: Arg1, Arg2 integer, pointer :: Binary ... end function Binary end module Funcs program What use Funcs integer :: X, Y = 42 10 .op. x = y end program What Is the "10" in "10 .op. x = y" an operand, and therefore an argument of a reference to Binary, or is .op. a reference to Unary and "10" a statement label? ANSWER: It was an oversight that this ambiguous program conforms to the syntax and constraints in two different ways. Since the standard does not establish an unique interpretation, it is not a conforming program. EDITS: none. OR Insert a constraint after C713 in subclause 7.2.1.1: C713a (R732) In free form or in a statement that begins after a semicolon, if is and can be interpreted as both and , in the case it can be interpreted as the statement shall have a label, and in the case it can be interpreted as the statement shall not have a label. OR Insert a constraint after C713 in subclause 7.2.1.1: C713a (R732) In free form or in a statement that begins after a semicolon, if the statement does not have a label, is , and is of the form , it shall not also be possible to interpret as . OR Insert a constraint after C713 in subclause 7.2.1.1: C713a (R732) In free form or in a statement that begins after a semicolon, if is and is of the form it shall not also be possible to interpret as . OR Insert a constraint after C713 in subclause 7.2.1.1: C713a (R732) In free form or in a statement that begins after a semicolon, if is , shall not be either or . No matter what choice for the above edits, add at the end of NOTE 7.35: "(10) .OP. X = Y an invalid assignment statement is 10 .OP. X = Y because if there are both unary and binary interfaces for .OP. it is ambiguous whether 10 is a statement label." ALTERNATIVE ANSWER: It was an oversight that this ambiguous program conforms to the syntax and constraints in two different ways. Since the standard does not establish an unique interpretation, it is not a conforming program. That this program is ambiguous was caused by an oversight to allow a to consist of , in which is a reference, as a defined operation, to a function that has a data pointer result. ALTERNATIVE EDITS: Replace R602 and C602 in subclause 6.2 by R602 <> <> C602 (R602) shall be a reference to a function that has a data pointer result. {Notice that this also precludes using a function referenced by way of a defined operation in otherwise harmless contexts, such as an actual argument that corresponds to a dummy argument that is not INTENT(in).} SUBMITTED BY: Van Snyder HISTORY: 12-149 m198 F08/xxxx submitted ----------------------------------------------------------------------