Skip to content

[Flang] [HLFIR] flang-new crashes (but it doesn't with -flang-deprecated-no-hlfir) #79731

Closed
@k-arrows

Description

@k-arrows

Crash itself is reproducible on Godbolt:
https://godbolt.org/z/MTEKP7f7b

Reproducer:

$ cat test.f03
module m1
    type base
        type(base), pointer :: next => null()
    end type
end module

module m2
    use m1
    type, extends(base) :: child
        integer :: i
    end type
end module

program p
    use m2
    type(base) :: b
    type(child), target :: c
    b = base(c%next)
end

If assertion is turned on, I can get the following message:

flang-new: /path_to_llvm_project/llvm-project/llvm/include/llvm/Support/Casting.h:662: decltype(auto) llvm::dyn_cast(From *) [To = mlir::omp::OutlineableOpenMPOpInterface, From = mlir::Operation]: Assertion `detail::isPresent(Val) && "dyn_cast on a non-existent value"' failed.

By specifying -flang-deprecated-no-hlfir, I can avoid the crash.

Metadata

Metadata

Assignees

No one assigned

    Labels

    crashPrefer [crash-on-valid] or [crash-on-invalid]flang:ir

    Type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions