Skip to content

--fast cannot handle double nested function calls #1677

Closed
@gptsarthak

Description

@gptsarthak
def func2()->i32:
    return 10

def func1() -> i32:
    return func2()

def test() -> i32:
    return func1()

print(test())
(lp) sarthak@pop-os:~/lpython/examples$ lpython nested.py
10
(lp) sarthak@pop-os:~/lpython/examples$ lpython --fast nested.py
ASR verify pass error: ASR verify: Block ~empty_block should resolve in current scope.
Internal Compiler Error: Unhandled exception
Traceback (most recent call last):
  Binary file "/home/sarthak/lpython/src/bin/lpython", in _start()
  File "./csu/../csu/libc-start.c", line 392, in __libc_start_main_impl()
  File "./csu/../sysdeps/nptl/libc_start_call_main.h", line 58, in __libc_start_call_main()
  File "/home/sarthak/lpython/src/bin/lpython.cpp", line 1750, in ??
    err = compile_python_to_object_file(arg_file, tmp_o, runtime_library_dir,
  File "/home/sarthak/lpython/src/bin/lpython.cpp", line 750, in ??
    res = fe.get_llvm3(*asr, pass_manager, diagnostics, infile);
  File "/home/sarthak/lpython/src/lpython/python_evaluator.cpp", line 58, in LCompilers::PythonCompiler::get_llvm3(LCompilers::ASR::TranslationUnit_t&, LCompilers::PassManager&, LCompilers::diag::Diagnostics&, std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> > const&)
    run_fn, infile);
  File "/home/sarthak/lpython/src/libasr/codegen/asr_to_llvm.cpp", line 7026, in LCompilers::asr_to_llvm(LCompilers::ASR::TranslationUnit_t&, LCompilers::diag::Diagnostics&, llvm::LLVMContext&, Allocator&, LCompilers::PassManager&, LCompilers::CompilerOptions&, std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> > const&, std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> > const&)
    pass_manager.apply_passes(al, &asr, pass_options, diagnostics);
  File "/home/sarthak/lpython/src/libasr/pass/pass_manager.h", line 214, in LCompilers::PassManager::apply_passes(Allocator&, LCompilers::ASR::TranslationUnit_t*, LCompilers::PassOptions&, LCompilers::diag::Diagnostics&)
    _apply_passes(al, asr, _with_optimization_passes, pass_options,
LCompilersException: Verify failed

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions