I am not sure to define it as "Bug in pass_array_by_data" or "Bug in asr_verify", here is brief of issue
For,
module find_fit_module
implicit none
public
contains
subroutine find_fit(expr)
interface
function expr(x) result(y)
implicit none
real, intent(in) :: x(:)
real :: y(size(x))
end function
end interface
end subroutine
end module
program main
use find_fit_module, only: find_fit
implicit none
call find_fit(expression)
contains
function expression(x) result(y)
real, intent(in) :: x(:)
real :: y(size(x))
y = x
end function
end program
LFortran
$ lfortran a.f90
ASR verify pass error: ASR verify: Var::m_v `x` cannot point outside of its symbol table
Internal Compiler Error: Unhandled exception
Traceback (most recent call last):
Binary file "/home/pranavchiku/lfortran/src/bin/lfortran", 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/pranavchiku/lfortran/src/bin/lfortran.cpp", line 1938, in ??
err = compile_to_object_file(arg_file, tmp_o, false,
File "/home/pranavchiku/lfortran/src/bin/lfortran.cpp", line 865, in ??
res = fe.get_llvm3(*asr, lpm, diagnostics, infile);
File "/home/pranavchiku/lfortran/src/lfortran/fortran_evaluator.cpp", line 342, in LCompilers::FortranEvaluator::get_llvm3(LCompilers::ASR::TranslationUnit_t&, LCompilers::PassManager&, LCompilers::diag::Diagnostics&, std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> > const&)
compiler_options, run_fn, infile);
File "/home/pranavchiku/lfortran/src/libasr/codegen/asr_to_llvm.cpp", line 6794, 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/pranavchiku/lfortran/src/libasr/pass/pass_manager.h", line 209, in LCompilers::PassManager::apply_passes(Allocator&, LCompilers::ASR::TranslationUnit_t*, LCompilers::PassOptions&, LCompilers::diag::Diagnostics&)
_apply_passes(al, asr, _passes, pass_options, diagnostics);
LCompilersException: Verify failed
It throws ASR verify failed as "The symbol table was not found in the scope of symtab."
This happens just after visiting pass_array_by_data.cpp where ASR node for function expression is replaced by expression_8 with a new symbol table, and then asr_verify pass is not able to find that and it throws error.
I am not sure to define it as "Bug in
pass_array_by_data
" or "Bug inasr_verify
", here is brief of issue For,It throws ASR verify failed as "The symbol table was not found in the scope of
symtab
."This happens just after visiting
pass_array_by_data.cpp
where ASR node for functionexpression
is replaced byexpression_8
with a new symbol table, and then asr_verify pass is not able to find that and it throws error.