Bug 47505 - [OOP] Intrinsics which should operate on polymorphic objects (BT_CLASS)
Summary: [OOP] Intrinsics which should operate on polymorphic objects (BT_CLASS)
Status: NEW
Alias: None
Product: gcc
Classification: Unclassified
Component: fortran (show other bugs)
Version: 4.6.0
: P3 normal
Target Milestone: ---
Assignee: Not yet assigned to anyone
URL:
Keywords: rejects-valid
Depends on:
Blocks:
 
Reported: 2011-01-28 08:37 UTC by Tobias Burnus
Modified: 2012-11-06 11:31 UTC (History)
1 user (show)

See Also:
Host:
Target:
Build:
Known to work:
Known to fail:
Last reconfirmed: 2012-11-06 00:00:00


Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description Tobias Burnus 2011-01-28 08:37:52 UTC
Bob (Robert Corbett of Oracle) reports at
http://j3-fortran.org/pipermail/j3/2011-January/004136.html

that most compilers do not return a BT_CLASS when invoking one of the following procedures; I have not checked - especially as polymorphic arrays are not yet supported. But I wouldn't be surprised if gfortran had the same problems:

<quote>
The Fortran standard explicitly indicates that a few intrinsic
functions (EXTENDS_TYPE_OF, SAME_TYPE_AS, and STORAGE_SIZE)
accept polymorphic arguments.

The list of intrinsic procedures that satisfy these criteria are

      ALLOCATED        ASSOCIATED        EXTENDS_TYPE_OF
      IMAGE_INDEX      IS_CONTIGUOUS     LBOUND
      LCOBOUND         MOVE_ALLOC        PRESENT
      SAME_TYPE_AS     SHAPE             SIZE
      STORAGE_SIZE     THIS_IMAGE        UBOUND
      UCOBOUND
[...]
This side thinks the following additional functions should accept
polymorphic arguments

      CSHIFT       EOSHIFT       MERGE      PACK
      RESHAPE      SHAPE         SIZE       SPREAD
      TRANSFER     TRANSPOSE     UNPACK
</quote>

And in a follow up:

<quote>
None of the implementations I tried treats the results of these
intrinsic functions as polymorphic.  Some implementations gave no
diagnostic message for passing polymorphic acutal arguments to the
intrinsic functions, but none allowed the results to be used in
contexts that required polymorphism.  I admit I find that strange.
</quote>
Comment 1 janus 2011-01-28 11:20:04 UTC
I think the following ones should work fine (re-check?):

 * ALLOCATED
 * ASSOCIATED
 * EXTENDS_TYPE_OF
 * SAME_TYPE_AS
 * STORAGE_SIZE

The array (+coarray?) intrinsics we can probably ignore for now, since we don't have polymorphic array support at this point.

A few ones that are left to check might be:

 * MOVE_ALLOC
 * PRESENT
 * MERGE
 * ...?
Comment 2 janus 2012-11-06 11:31:09 UTC
Note: CLASS-support for TRANSFER has been implemented in r193226, cf. PR 54917.