To: J3 12-114 From: Robert Corbett Subject: passing arrays of extended type objects Date: 2012 January 30 ---------------------------------------------------------------------- NUMBER: TITLE: passing arrays of extended type objects KEYWORDS: assumed-size arrays, extended type DEFECT TYPE: STATUS: J3 consideration in progress QUESTION: Can an assumed-size array of extended type be passed as an actual argument to a nonpolymorphic dummy array whose type is the parent type of the extended type? Clause 6.5.2 "Whole arrays" [121:10-12] permits an assumed-size array to appear as an actual argument in a procedure reference. Consider the program MODULE TYPES TYPE REC INTEGER A END TYPE TYPE, EXTENDS(REC) :: REC2 INTEGER B END TYPE END SUBROUTINE SUB1(A, N) USE TYPES CLASS(REC), INTENT(IN) :: A(*) CALL SUB2(A, N) END SUBROUTINE SUB2(A, N) USE TYPES TYPE(REC) A(*) PRINT *, A(:N)%A END PROGRAM MAIN USE TYPES CLASS(REC), ALLOCATABLE :: A(:) INTERFACE SUBROUTINE SUB1(A, N) USE TYPES CLASS(REC), INTENT(IN) :: A(*) END SUBROUTINE END INTERFACE ALLOCATE (A, SOURCE = (/(REC2(I, -I), I = 1, 10)/)) CALL SUB1(A, 10) END The subroutine reference in SUB1 that invokes SUB2 appears to be standard conforming according to that clause. Is that intended? The program was compiled and run using five different implementations. Two of the implementations produced the expected output 1 2 3 4 5 6 7 8 9 10 Three did not. ANSWER: EDITS: SUBMITTED BY: Robert Corbett HISTORY: 12-xxx m197 submitted