(j3.2006) Intrinsic assignment question

Bill Long longb
Fri May 30 15:01:14 EDT 2014


On May 30, 2014, at 1:19 PM, Daniel C Chen <cdchen at ca.ibm.com> wrote:

> Hello all,
> 
> Please consider the following test case:
> 
> real, allocatable :: r1, r2
> r1 = r2

r2 is not allocated -> r2 is not defined.  But this <expr> represents a reference to r2 (2.4.3.3), and in that context the r2 has to be defined (6.2p2). Conclusion:  Code is not conforming.

Cheers,
Bill




> print*, allocated(r1), allocated(r2)
> end
> 
> Question:
> 1. Is the above test case standard conforming? I couldn't find in the standard that we disallow using an unallocated scalar as the 'expr' in an intrinsic assignment, but I could have missed it.
> 
> 2. If it is standard conforming, what should the output be?
> a) FF
> b) TF
> 
> I couldn't find in the standard what is supposed to happen to the 'variable' when the 'expr' is an unallocated allocatable scalar of intrinsic type after the execution of the intrinsic assignment. 
> The closest words I can find is the following:
> 7.2.1.3
> ...
> ... If the variable is or becomes an unallocated allocatable variable, it is then allocated with
> 20 ? if the variable is polymorphic, the same dynamic type as expr ,
> 21 ? each deferred type parameter equal to the corresponding type parameter of expr ,
> 22 ? if the variable is an array and expr is scalar, the same bounds as before, and
> 23 ? if expr is an array, the shape of expr with each lower bound equal to the corresponding element of LBOUND (expr ).
> 
> But none of the bullets seems describe the scenario of the test case.
> 
> Can someone please shed some light on this issue?
> 
> Thanks,
> 
> Daniel
> 
> XL Fortran Development - 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
> 
> _______________________________________________
> J3 mailing list
> J3 at mailman.j3-fortran.org
> http://mailman.j3-fortran.org/mailman/listinfo/j3

Bill Long                                                                       longb at cray.com
Fortran Technical Suport  &                                  voice:  651-605-9024
Bioinformatics Software Development                     fax:  651-605-9142
Cray Inc./ Cray Plaza, Suite 210/ 380 Jackson St./ St. Paul, MN 55101





More information about the J3 mailing list