Skip to content

Error : Verify Failed , when using --fast #1668

Closed
@gptsarthak

Description

@gptsarthak

Came across this error when trying out benchmarks. Error occurs only when compiling with the --fast optimization.

def func() -> i32:
     return 30

def test() -> i32:
    temp: i32 = func()
    return temp

x : i32 
x = test()
print(x)
(lp) sarthak@pop-os:~/lpython$ lpython examples/test.py
30
(lp) sarthak@pop-os:~/lpython$ lpython --fast examples/test.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 7027, 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

    bugSomething isn't working

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions