[J3] Standard conformance of parameterized derived type usage

Malcolm Cohen malcolm at nag-j.co.jp
Tue Nov 10 19:52:08 EST 2020


No, it is not conforming, it violates a constraint:

C762 (R737) If component-initialization appears, every type parameter and
array bound of the component shall be a colon or constant expression.

Cheers,
-- 
..............Malcolm Cohen, NAG Oxford/Tokyo.

-----Original Message-----
From: J3 <j3-bounces at mailman.j3-fortran.org> On Behalf Of William Clodius
via J3
Sent: Wednesday, November 11, 2020 9:36 AM
To: General J3 interest list <j3 at mailman.j3-fortran.org>
Cc: William Clodius <w.clodius at icloud.com>
Subject: [J3] Standard conformance of parameterized derived type usage

Is the following program standard conforming?

PROGRAM TEST_LEN_PARAMETER
    IMPLICIT NONE
    TYPE :: T(N)
        iNTEGER, LEN :: N
        TYPE(T(N+1)), POINTER :: P => NULL()
    END TYPE T
    TYPE(T(0)) :: A
    ALLOCATE(A % P)
    ALLOCATE(A % P % P)
    WRITE(*,'(A, I0)') 'A % N = ', A % N
    WRITE(*,'(A, I0)') 'A % P % N = ', A % P % N
    WRITE(*,'(A, I0)') 'A % P % P % N = ', A % P % P % N
END PROGRAM TEST_LEN_PARAMETER

If so what should be the output?

If so are there any processors that successfully process the code?




More information about the J3 mailing list