J3/04-334 Date: 10 June 2004 To: J3 From: Rob James Subject: VALUE attribute for passed-object dummy arguments NUMBER: TITLE: VALUE attribute for passed-object dummy arguments KEYWORDS: VALUE, passed-object, dummy argument DEFECT TYPE: STATUS: J3 consideration in progress QUESTION: Consider the following program: module m type t integer*4 :: id contains procedure :: doThings => doThingsT end type contains subroutine doThingsT (a) class(t), value :: a a%id = 5 end subroutine end module program p use m type(t) :: z = t(1) call z%doThings print *, z%id end program Section 12.4.1.1 of Fortran 2003 states: In a reference to a type-bound procedure that has a passed-object dummy argument (4.5.3.3), the of the or is associated, as an actual argument, with the passed-object dummy argument. This seems to be contrary to the idea of the VALUE attribute. For argument association where the dummy argument has the VALUE attribute, section 12.4.1.2 of Fortran 2003 states: If the dummy argument has the VALUE attribute it becomes associated with a definable anonymous data object whose initial value is that of the actual argument. Subsequent changes to the value or definition status of the dummy argument do not affect the actual argument. It looks like the passed-object dummy argument is argument associated with the object z itself, rather than an anonymous data object whose initial value is that of z. What value should the above program print? ANSWER: This program should print the value 1. The inconsistency between sections 12.4.1.1 and 12.4.1.2 should be fixed. Edits are provided to correct this oversight. EDITS: All edits refer to 04-007. [268:17] After "dummy argument (4.5.3.3)", insert "without the VALUE attribute". [268:19+] Add the following paragraph: In a reference to a type-bound procedure that has a passed-object dummy argument (4.5.3.3) with the VALUE attribute, a definable anonymous data object whose initial value is that of the of the or is associated, as an actual argument, with the passed-object dummy argument. SUBMITTED BY: Rob James HISTORY: 04-334 m169 Submitted