Bug 52403 - coarray component gives error with CLASS( ) declaration
coarray component gives error with CLASS( ) declaration
Status: UNCONFIRMED
Product: gcc
Classification: Unclassified
Component: fortran
4.6.1
: P3 normal
: ---
Assigned To: Not yet assigned to anyone
:
Depends on: 51632 52052
Blocks:
  Show dependency treegraph
 
Reported: 2012-02-27 15:50 UTC by Bill Long
Modified: 2012-09-21 18:53 UTC (History)
0 users

See Also:
Host:
Target:
Build:
Known to work:
Known to fail:
Last reconfirmed:


Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description Bill Long 2012-02-27 15:50:25 UTC
Possible another case that needs to be considered in Bug 52052

> cat test.f90
module m_coarray
  implicit none

  private

  type, public :: coarray_t
    integer, allocatable, private :: value(:)[:]
     contains
       procedure :: allocate_myCoarray => allocate_myCoarray_sub
  end type

contains
  subroutine allocate_myCoarray_sub(this)
    class(coarray_t), intent(inout) :: this

    allocate( this%value(num_images())[*] )
  end subroutine
end module
!===============================================================================
program main
  use m_coarray
  implicit none

  type(coarray_t) :: caf

end program

> ftn -fcoarray=single test.f90
test.f90:14.43:

    class(coarray_t), intent(inout) :: this
                                           1
Error: Component '_data' at (1) with coarray component shall be a nonpointer,
nonallocatable scalar
test.f90:14.43:

    class(coarray_t), intent(inout) :: this
                                           1
Error: Component '_def_init' at (1) with coarray component shall be a
nonpointer, nonallocatable scalar
test.f90:14.43:

    class(coarray_t), intent(inout) :: this
                                           1
Error: Component '_def_init' at (1) with coarray component shall be a
nonpointer, nonallocatable scalar
test.f90:16.14:

    allocate( this%value(num_images())[*] )
              1
Error: Coindexed allocatable object at (1)
test.f90:21.15:

  use m_coarray
               1
Fatal Error: Can't open module file 'm_coarray.mod' for reading at (1): No such
file or directory


I suspect the CLASS declaration is triggering come sort of hidden parent
component that fails the requirements.

Also fails with gfortran 4.7.

Compiles without error with Cray and Intel compilers.

I suspect this is just a case of incomplete implementation at this stage.
Comment 1 Tobias Burnus 2012-02-27 17:21:10 UTC
(In reply to comment #0)
> I suspect this is just a case of incomplete implementation at this stage.

Yes. Polymorphic arrays (a prerequisite for polymorphic coarrays) were only added in December 2011 - too late to finish polymorphic coarrays before the 4.7 release. Given that 4.7 will be released soon*, polymorphic coarrays will only be fully supported in GCC 4.8.

The issue you are currently seen is PR 51632.

* Cf. http://gcc.gnu.org/ml/fortran/2012-02/msg00094.html and http://gcc.gnu.org/gcc-4.7/changes.html