[J3] Does LHS of a pointer assignment have the POINTER attribute?
Daniel C Chen
cdchen at ca.ibm.com
Fri Oct 8 02:24:14 UTC 2021
Thanks Malcolm,
Part of the question is if fp(1:) has the POINTER attribute. From your
explanation, I suppose the answer is "NO", correct?
Thanks,
Daniel Chen
XL Fortran Development, Fortran Standard Representative
IBM Toronto Software Lab
Phone: 905-413-3056
Tie: 969-3056
Email: cdchen at ca.ibm.com
From: "Malcolm Cohen via J3" <j3 at mailman.j3-fortran.org>
To: "'General J3 interest list'" <j3 at mailman.j3-fortran.org>
Cc: "Malcolm Cohen" <malcolm at nag-j.co.jp>
Date: 2021-10-07 08:00 PM
Subject: [EXTERNAL] Re: [J3] Does LHS of a pointer assignment have the
POINTER attribute?
Sent by: "J3" <j3-bounces at mailman.j3-fortran.org>
>fp(1:) can appear as the LHS of a pointer assignment, does it mean fp(1:)
have the POINTER attribute? If so, case 3 is not conforming as POINTER is
not interoperable. You are confusing two different things. In fp(1:) =>
target
>fp(1:) can appear as the LHS of a pointer assignment, does it mean fp(1:)
have the POINTER attribute? If so, case 3 is not conforming as POINTER is
not interoperable.
You are confusing two different things. In
fp(1:) => target
the “(1:)” are “( lower-bounds-expr : )”
In the case of an actual argument, the “(1:)” are “( section-subscript-list
)”.
Similarly, in
REAL X(2,3,4)
the 2, 3 and 4 are upper bounds expressions, *and not subscripts*.
It should be obvious that the contexts are different, and in different
contexts, identical character sequences may have different meaning. In
particular, array bounds are not subscripts and vice versa.
I note that the “conforming/not conforming” question is being answered via
interp, and the current answer (not yet fully settled) is that all your
cases are conforming.
Cheers,
--
..............Malcolm Cohen, NAG Oxford/Tokyo.
From: J3 <j3-bounces at mailman.j3-fortran.org> On Behalf Of Daniel C Chen via
J3
Sent: Friday, October 8, 2021 1:57 AM
To: j3 at mailman.j3-fortran.org
Cc: Daniel C Chen <cdchen at ca.ibm.com>
Subject: [J3] Does LHS of a pointer assignment have the POINTER attribute?
Consider the following code:
use iso_c_binding
integer, pointer :: fp(:)
integer, target :: tar(10)
fp => tar
fp(1:) => tar
print *, c_sizeof(fp(:)) ! case 1: conforming
print *, c_sizeof(fp) ! case 2: not conforming
print *, c_sizeof(fp(1:)) ! case 3: ??
end
fp(1:) can appear as the LHS of a pointer assignment, does it mean fp(1:)
have the POINTER attribute? If so, case 3 is not conforming as POINTER is
not interoperable.
Thanks,
Daniel Chen
XL Fortran Development, Fortran Standard Representative
IBM Toronto Software Lab
Phone: 905-413-3056
Tie: 969-3056
Email: cdchen at ca.ibm.com
Disclaimer
The Numerical Algorithms Group Ltd is a company registered in England and
Wales with company number 1249803. The registered office is: 30 St. Giles,
Oxford, OX1 3LE, United Kingdom. Please see our Privacy Notice for
information on how we process personal data and for details of how to stop
or limit communications from us.
This e-mail has been scanned for all viruses and malware, and may have been
automatically archived by Mimecast Ltd, an innovator in Software as a
Service (SaaS) for business.
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <https://mailman.j3-fortran.org/pipermail/j3/attachments/20211007/91a4f432/attachment-0001.htm>
-------------- 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/20211007/91a4f432/attachment-0001.gif>
More information about the J3
mailing list