minidftatom: AssertFailed: symtab->parent == nullptr
$ cd src
$ FC=lfortran cmake .
$ make
Scanning dependencies of target F_atom_U
[ 6%] Building Fortran object CMakeFiles/F_atom_U.dir/types.f90.o
[ 13%] Building Fortran object CMakeFiles/F_atom_U.dir/constants.f90.o
[ 20%] Building Fortran object CMakeFiles/F_atom_U.dir/dft_data.f90.o
[ 26%] Building Fortran object CMakeFiles/F_atom_U.dir/energies.f90.o
Traceback (most recent call last):
File "/Users/certik/repos/lfortran/lfortran/src/bin/lfortran.cpp", line 1225
return compile_to_object_file(arg_file, outfile, false,
File "/Users/certik/repos/lfortran/lfortran/src/bin/lfortran.cpp", line 601
result = fe.get_asr2(input);
File "/Users/certik/repos/lfortran/lfortran/src/lfortran/codegen/evaluator.cpp", line 469
asr = ast_to_asr(al, *ast, symbol_table);
File "/Users/certik/repos/lfortran/lfortran/src/lfortran/semantics/ast_to_asr.cpp", line 3129
return tu;
File "/Users/certik/repos/lfortran/lfortran/src/lfortran/semantics/ast_to_asr.cpp", line 708
current_scope = al.make_new<SymbolTable>(parent_scope);
File "/Users/certik/repos/lfortran/lfortran/src/lfortran/ast.h", line 3577
void visit_ast(const ast_t &b) { visit_ast_t(b, self()); }
File "/Users/certik/repos/lfortran/lfortran/src/lfortran/ast.h", line 3541
case astType::mod: { v.visit_mod((const mod_t &)x); return; }
File "/Users/certik/repos/lfortran/lfortran/src/lfortran/ast.h", line 3580
void visit_mod(const mod_t &b) { visit_mod_t(b, self()); }
File "/Users/certik/repos/lfortran/lfortran/src/lfortran/ast.h", line 3261
case modType::Module: { v.visit_Module((const Module_t &)x); return; }
File "/Users/certik/repos/lfortran/lfortran/src/lfortran/semantics/ast_to_asr.cpp", line 729
std::string sym_name = x.m_name;
File "/Users/certik/repos/lfortran/lfortran/src/lfortran/ast.h", line 3585
void visit_program_unit(const program_unit_t &b) { visit_program_unit_t(b, self()); }
File "/Users/certik/repos/lfortran/lfortran/src/lfortran/ast.h", line 3274
case program_unitType::Function: { v.visit_Function((const Function_t &)x); return; }
File "/Users/certik/repos/lfortran/lfortran/src/lfortran/semantics/ast_to_asr.cpp", line 868
std::string arg_s = arg;
File "/Users/certik/repos/lfortran/lfortran/src/lfortran/ast.h", line 3591
void visit_unit_decl2(const unit_decl2_t &b) { visit_unit_decl2_t(b, self()); }
File "/Users/certik/repos/lfortran/lfortran/src/lfortran/ast.h", line 3290
case unit_decl2Type::Declaration: { v.visit_Declaration((const Declaration_t &)x); return; }
File "/Users/certik/repos/lfortran/lfortran/src/lfortran/semantics/ast_to_asr.cpp", line 1274
type = TYPE(ASR::make_RealPointer_t(al, x.base.base.loc,
File "/Users/certik/repos/lfortran/lfortran/src/lfortran/semantics/ast_to_asr.cpp", line 1074
if (x.m_vartype == nullptr &&
File "/Users/certik/repos/lfortran/lfortran/src/lfortran/ast.h", line 3655
void visit_expr(const expr_t &b) { visit_expr_t(b, self()); }
File "/Users/certik/repos/lfortran/lfortran/src/lfortran/ast.h", line 3408
case exprType::FuncCallOrArray: { v.visit_FuncCallOrArray((const FuncCallOrArray_t &)x); return; }
File "/Users/certik/repos/lfortran/lfortran/src/lfortran/semantics/ast_to_asr.cpp", line 1358
ASR::Function_t *mfn = ASR::down_cast<ASR::Function_t>(t);
File "/Users/certik/repos/lfortran/lfortran/src/lfortran/asr_utils.cpp", line 107
LFORTRAN_ASSERT(symtab->parent == nullptr);
File "/Users/certik/repos/lfortran/lfortran/src/lfortran/exception.h", line 153
{
AssertFailed: symtab->parent == nullptr
make[2]: *** [CMakeFiles/F_atom_U.dir/build.make:251: CMakeFiles/F_atom_U.dir/energies.f90.o] Error 1
make[1]: *** [CMakeFiles/Makefile2:95: CMakeFiles/F_atom_U.dir/all] Error 2
make: *** [Makefile:103: all] Error 2
To debug this, let's isolate the problem, first and write a clean test for LFortran that triggers this, and then let's fix it.