llvm / llvm-project

The LLVM Project is a collection of modular and reusable compiler and toolchain technologies.
http://llvm.org
Other
27.69k stars 11.39k forks source link

[Flang] verification of lowering to FIR failed with "internal error when processing function return" #94147

Open k-arrows opened 2 months ago

k-arrows commented 2 months ago

Reproducible on Godbolt: https://godbolt.org/z/3f1h6bW57

Reproducer:

function f(x) result(res)
    integer :: i
    procedure() :: res
end function

With assertion-enabled flang-new, the following assertion failure was observed after "error: verification of lowering to FIR failed":

llvm-project/flang/include/flang/Lower/StatementContext.h:57: Fortran::lower::StatementContext::~StatementContext(): Assertion `cufs.empty() && "invalid StatementContext destructor call"' failed.
llvmbot commented 2 months ago

@llvm/issue-subscribers-flang-ir

Author: None (k-arrows)

Reproducible on Godbolt: https://godbolt.org/z/3f1h6bW57 Reproducer: ```console function f(x) result(res) integer :: i procedure() :: res end function ``` With assertion-enabled flang-new, the following assertion failure was observed after "error: verification of lowering to FIR failed": ```txt llvm-project/flang/include/flang/Lower/StatementContext.h:57: Fortran::lower::StatementContext::~StatementContext(): Assertion `cufs.empty() && "invalid StatementContext destructor call"' failed. ```
llvmbot commented 2 months ago

@llvm/issue-subscribers-bug

Author: None (k-arrows)

Reproducible on Godbolt: https://godbolt.org/z/3f1h6bW57 Reproducer: ```console function f(x) result(res) integer :: i procedure() :: res end function ``` With assertion-enabled flang-new, the following assertion failure was observed after "error: verification of lowering to FIR failed": ```txt llvm-project/flang/include/flang/Lower/StatementContext.h:57: Fortran::lower::StatementContext::~StatementContext(): Assertion `cufs.empty() && "invalid StatementContext destructor call"' failed. ```