Skip to content

[Flang] Unlimited polymorphic ARRAY= argument is not supported by intrinsic EOSHIFT #115923

@DanielCChen

Description

@DanielCChen

Consider the following code:

module m
    type Base
        integer i
    end type

    type, extends(Base) :: Child
        integer j
    end type
end module

program transfer003
use m
    class(Base), pointer :: c1(:,:,:)
    class(*), pointer :: b1(:)

    allocate(c1(2,2,2), SOURCE=reshape((/(Child(i,i-1),i=101,108)/), &
     (/2,2,2/)))
    allocate(b1(12), SOURCE=(/(Base(i),i=1,12)/))

    select type(name1=>eoshift(transfer(c1, b1), -4, Base(-8)))
        type is (Base)
            print *, name1
        class default
            error stop 1
    end select
end

Flang issues an error as

t1.f:20:32: error: Actual argument for 'array=' has bad type 'CLASS(*)'
      select type(name1=>eoshift(transfer(c1, b1), -4, Base(-8)))
                                 ^^^^^^^^^^^^^^^^

The standard doesn't seem disallow unlimited polymorphic in this case.

XLF compiles and runs successfully.
gfortran issues a TODO message

Error: TODO: unlimited polymorphic MOLD in TRANSFER intrinsic at (1)

Metadata

Metadata

Assignees

Labels

bugIndicates an unexpected problem or unintended behaviorflang:frontend

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions