Skip to content

[flang] Allocate object must be conformable with the SOURCE= in an ALLOCATE statement #143900

@DanielCChen

Description

@DanielCChen

Consider the following code

    type base
        real      :: r1
    end type

    type (base), allocatable :: b1(:)
    type (base) :: b2 (10)

    b2 = base(10.0)

    allocate (b1(5), source=(/(b2(j),j=10,6)/))  !<-- this is illegal
end

The shape of the SOURCE= expr is 0 while the shape of the allocate object is 5.
It is not conforming to the standard. All ifort, gfortran and XLF issues an error.
Is this an intentional extension for Flang?

Metadata

Metadata

Assignees

Type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions