[J3] Question on Table 10.8: Intrinsic assignment type conformance

Daniel C Chen cdchen at ca.ibm.com
Fri Jun 14 11:42:42 EDT 2019


I think the function result 'r' is defined as the only component b_t has is
a nonpointer component that is default inittialized.

19.6.5
(19)Allocation of an object that has a nonpointer default-initialized
subcomponent, except by an ALLOCATE statement with a SOURCE= specifier,
causes that subcomponent to become defined.

Thanks,

Daniel

XL Fortran Development, Fortran Standard Representative
IBM Toronto Software Lab
Phone: 905-413-3056
Tie: 969-3056
Email: cdchen at ca.ibm.com
http://www.ibm.com/software/awdtools/fortran/xlfortran



From:	Robert Corbett via J3 <j3 at mailman.j3-fortran.org>
To:	General J3 interest list <j3 at mailman.j3-fortran.org>
Cc:	Robert Corbett <rpcorbett at att.net>
Date:	06/14/2019 01:56 AM
Subject:	[EXTERNAL] Re: [J3] Question on Table 10.8: Intrinsic
            assignment type conformance
Sent by:	"J3" <j3-bounces at mailman.j3-fortran.org>



For the definition status of objects that have derived type, see 19.6.1 p4.
Clearly, a scalar object of derived type that has no components is defined.
The derived types shown in your example all have components.

Robert Corbett

> On Jun 13, 2019, at 6:14 PM, Vipul Parekh via J3
<j3 at mailman.j3-fortran.org> wrote:
>
> On Thu, Jun 13, 2019 at 6:55 PM Steve Lionel via J3
> <j3 at mailman.j3-fortran.org> wrote:
>>
>> ..
>> Note the use of "declared type". The declared type of b and f() are both
>> b_t, so this conforms.
>>
>
> Thanks, Steve, for your input.  I'd noticed that the use of "declared
> type", I was wondering whether there was any additional interpretation
> anywhere else in the standard that came into play with this
> assignment.  There isn't any such considerations, it appears.
>
>> As for the warning from the Cray compiler, it is correct. An ALLOCATE of
>> a variable without SOURCE= does not define the variable. See 19.6.5.
>> ..
>
> That's good to know.  Again I was wondering if there was an item in
> section 19.6.5 toward derived types with zero components that I had
> failed to notice.  Upon reading "Allocation of a zero-sized array or
> zero-length character variable causes the array or variable to become
> defined." and with *sequence types*, "When all components of a
> structure of a numeric sequence type or character sequence type become
> defined as a result of partially associated objects becoming defined,
> the structure becomes defined," I became expectant of a consideration
> somewhere in the standard regarding a variable of a derived type with
> no components getting defined upon allocation.  That would only be
> common sense in my view.  But it must not be that simple and
> straightforward with derived types.
>
> Regards,
> Vipul



-------------- next part --------------
An HTML attachment was scrubbed...
URL: <https://mailman.j3-fortran.org/pipermail/j3/attachments/20190614/7885a4d1/attachment.html>
-------------- next part --------------
A non-text attachment was scrubbed...
Name: graycol.gif
Type: image/gif
Size: 105 bytes
Desc: not available
URL: <https://mailman.j3-fortran.org/pipermail/j3/attachments/20190614/7885a4d1/attachment.gif>


More information about the J3 mailing list