Tiff file with symengine parser segfault
Running dune-copasi binary with valgrind on a config file with a tiff file initial condition using the symengine parser gives:
[2023-11-22 09:52:04.082] [info] Reading configuration file '/home/lkeegan/SSC/spatial-model-editor/build/dune.ini'
[2023-11-22 09:52:04.170] [info] Starting dune-copasi
[2023-11-22 09:52:04.228] [info] Reading grid file 'grid.msh'
==216937== Invalid read of size 8
==216937== at 0x9CFB43: std::set<SymEngine::RCP<SymEngine::Basic const>, SymEngine::RCPBasicKeyLess, std::allocator<SymEngine::RCP<SymEngine::Basic const> > > SymEngine::atoms<SymEngine::FunctionSymbol>(SymEngine::Basic const&) (in /opt/smelibs/bin/dune-copasi)
==216937== by 0x9CDCE8: SymEngine::function_symbols(SymEngine::Basic const&) (in /opt/smelibs/bin/dune-copasi)
==216937== by 0x76644F: Dune::Copasi::SymEngineParser::setup_function_symbol(std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> > const&) (in /opt/smelibs/bin/dune-copasi)
==216937== by 0x769813: Dune::Copasi::SymEngineParser::define_function(std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> > const&, std::function<double (double, double)> const&) (in /opt/smelibs/bin/dune-copasi)
==216937== by 0x75E670: Dune::Copasi::ParserContext::add_context(Dune::Copasi::Parser&) const (in /opt/smelibs/bin/dune-copasi)
==216937== by 0x1AAEDA: std::unique_ptr<Dune::mdgrid::MultiDomainGrid<Dune::UGGrid<2>, Dune::mdgrid::DynamicSubDomainCountTraits<2, 10ul, Dune::mdgrid::AllCodims> >, std::default_delete<Dune::mdgrid::MultiDomainGrid<Dune::UGGrid<2>, Dune::mdgrid::DynamicSubDomainCountTraits<2, 10ul, Dune::mdgrid::AllCodims> > > > Dune::Copasi::make_multi_domain_grid<Dune::mdgrid::MultiDomainGrid<Dune::UGGrid<2>, Dune::mdgrid::DynamicSubDomainCountTraits<2, 10ul, Dune::mdgrid::AllCodims> > >(Dune::ParameterTree&, std::shared_ptr<Dune::Copasi::ParserContext const>) (in /opt/smelibs/bin/dune-copasi)
==216937== by 0x1A3B53: main (in /opt/smelibs/bin/dune-copasi)
==216937== Address 0x0 is not stack'd, malloc'd or (recently) free'd
I haven't fully understood the implementation, but it looks setup_function_symbol
is being called before an expression has been assigned.
(The tiff file inputs worked using muparser)
Input files attached to reproduce: tiff.tar.gz