(j3.2006) polymorphic assumed-size actual arguments

Jim Xia jimxia
Fri Dec 17 11:03:18 EST 2010


XLF gives the following results

> a.out
 1 2 3 4 5 6 7 8 9 10


Note I have to modify the assignment in the main program from

          A = [ (REC2(I, I+1), I = 1, 10) ]

to
         allocate (A(10), source = [ (REC2(I, I+1), I = 1, 10) ])

because we don't support auto-allocation of poly-allocatables in F08.

Cheers,


Jim Xia

XL Fortran Compiler Test
IBM Toronto Lab at 8200 Warden Ave, Markham, On, L6G 1C7
Phone (905) 413-3444  Tie-line 313-3444
email: jimxia at ca.ibm.com
D2/YF7/8200 /MKM

http://www.ibm.com/software/awdtools/fortran/xlfortran

j3-bounces at j3-fortran.org wrote on 12/17/2010 04:45:01 AM:

> [image removed] 
> 
> (j3.2006) polymorphic assumed-size actual arguments
> 
> Robert Corbett 
> 
> to:
> 
> fortran standards email list for J3
> 
> 12/17/2010 04:48 AM
> 
> Sent by:
> 
> j3-bounces at j3-fortran.org
> 
> Please respond to robert.corbett, fortran standards email list for J3
> 
> Is the program given below standard conforming?  If not, why not?
> 
>        MODULE TYPES
>          PRIVATE
>          PUBLIC REC, REC2
> 
>          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
> 
>          A = [ (REC2(I, I+1), I = 1, 10) ]
>          CALL SUB1(A, 10)
>        END
> _______________________________________________
> J3 mailing list
> J3 at j3-fortran.org
> http://j3-fortran.org/mailman/listinfo/j3
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://j3-fortran.org/pipermail/j3/attachments/20101217/184767a2/attachment.htm>



More information about the J3 mailing list