[J3] Standard conformance of parameterized derived type usage
Van Snyder
van.snyder at sbcglobal.net
Tue Nov 10 21:03:50 EST 2020
I can see the need for the C762 if initialization provides values.
For pointer initialization, all the processor does is fill a
descriptor,the extents of whose internal pieces do not depend upon
lengths or extents of the component.That's the same as what a processor
does for an allocatable component.
I couldn't find a constraint that requires a length parameter of an
allocatable component to be acolon or a constant expression, so I
assume processors can fill its descriptors for allocatablecomponents
that have lengths that depend upon length parameters.
I couldn't find a constraint that the bounds in <initial-data-target>in
pointer component initialization are required to be constants, so
Iassume processors can fill their descriptors in that case.
The constraint appears to be unhelpful in the case of pointer
components,
especially if initialized to NULL().
Is it really necessary for pointers? Even if not initialized to NULL()?
=======================================================================
==
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?
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <https://mailman.j3-fortran.org/pipermail/j3/attachments/20201110/2fd39c73/attachment-0001.htm>
More information about the J3
mailing list