J3/05-175 Date: 25 Apr 2005 To: J3 From: Rob James Subject: Default initialization of INTENT(OUT), assumed-size arrays NUMBER: TITLE: Default initialization of INTENT(OUT), assumed-size arrays KEYWORDS: default initialization, INTENT(OUT), assumed size, polymorphism DEFECT TYPE: STATUS: J3 consideration in progress QUESTION: Consider the following program: MODULE m TYPE base INTEGER I END TYPE TYPE, EXTENDS(base) :: child INTEGER :: j = 5 END TYPE CONTAINS SUBROUTINE sub(b) CLASS(base), INTENT(OUT) :: b(*) END SUBROUTINE END MODULE PROGRAM foo USE m TYPE(child) :: c(3) c%i = 12 c%j = 47 CALL sub(c) PRINT *, c%j END PROGRAM C544 prevents nonpolymorphic, INTENT(OUT), assumed-size arrays from having default initialization. The polymorphic case, however, is not checkable at compile time, so it cannot be a constraint. Was it intended that the dynamic type of an INTENT(OUT), assumed-size array could have default initialization? If so, what does the above program print? ANSWER: No, it was not intended that the dynamic type of such an array could have default initialization. Edits are provided to correct this oversight. EDITS: TBD. I'm not sure if C544 should be made into a rule instead of a constraint, or if a new rule should be added. SUBMITTED BY: Rob James HISTORY: 05-175 m172 Submitted