[Patch, Fortran] PRs 59103/58676/41724 - honour pure-/elementalness of intrinsics, add elemental checks
Tobias Burnus
burnus@net-b.de
Sun Dec 8 14:31:00 GMT 2013
This patch is about rejects-valid and accepts-invalid and does
essentially only:
a) It ensures that sym->attr.pure/elemental gets set for pure/elemental
intrinsics (isym->pure/elemental).
b) It rejects dummy procedures / procedure pointers which are ELEMENTAL.
* * *
To quote (link see PR) from interpretation request F03-0130:
Q: "When one of these procedures [i.e. the specific intrinsic procedures
listed in 13.6 and not marked with a bullet] is associated with a dummy
procedure or procedure pointer, does it still have the elemental property?"
A: "The specific intrinsic procedure itself retains the elemental
property (so a reference using its own name can be elemental), but the
dummy procedure or procedure pointer associated with it is not elemental
and so cannot be used to reference the specific intrinsic procedure
elementally."
And the Fortran standard:
C1218 (R1211) If a proc-interface describes an elemental procedure, each
procedure-entity-name shall specify an external procedure.
"12.5.2.9 Actual arguments associated with dummy procedure entities [...]
If the interface of a dummy procedure is explicit, its characteristics
as a procedure (12.3.1) shall be the same as those of its effective
argument, except that a pure effective argument may be associated with a
dummy argument that is not pure and an elemental intrinsic actual
procedure may be associated with a dummy procedure (which cannot be
elemental)."
* * *
I think the current patch handles it correctly. Last think I was
pondering on is whether "procedure(sin) :: bar" makes "bar" elemental or
not. I think it does, which makes it impossible to use, e.g.
"procedure(sin), pointer :: pp => sin". However, creating an (abstract)
interface which matches "sin" except for the elemental attribute, is
possible and permits: "procedure(sin_interf), pointer :: pp => sin".
I hope that I got everything right in the patch.
Build and regtested on x86-64-gnu-linux.
OK for the trunk?
Tobias
-------------- next part --------------
A non-text attachment was scrubbed...
Name: elemental-pure.diff
Type: text/x-patch
Size: 9223 bytes
Desc: not available
URL: <http://gcc.gnu.org/pipermail/fortran/attachments/20131208/df6b7c14/attachment.bin>
More information about the Fortran
mailing list