Skip to content

[flang] Unlimited pointer assignment within FORALL caused FIR verification failure #143569

@DanielCChen

Description

@DanielCChen

Consider the following code:

program fpAssgn025a

    type anyContainer
        class (*), pointer :: data => null()
        !character*1, pointer :: data => null()    ! workaround 1
    end type

    type (anyContainer) :: co_a1(10)

    character*1, target :: ch1(10)

!    allocate (c1(10))

    forall (i=1:10)
!    do i = 1, 10                                   ! workaround 2
        co_a1(i)%data => ch1(i)
!    end do
    end forall

end

Flang has

error: loc("t.f":16:9): 'fir.embox' op LEN parameters require CHARACTER or derived type
error: verification of lowering to FIR failed

If I apply either workaround marked in the code (1. don't use unlimited poly; 2. use do loop instead of forall), it compiles successfully.

Update (Oct 22, 2025): After the fix of PR #164279 , the code in this issue now fails at:

fir.convert' op invalid type conversion'!fir.box<!fir.ptr<!fir.char<1>>>' / '!fir.class<!fir.ptr<none>>'

Metadata

Metadata

Assignees

Type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions