optimizer crashes in hof-101

Bug #866839 reported by Daniel Turcanu
6
This bug affects 1 person
Affects Status Importance Assigned to Milestone
Zorba
Fix Released
High
Nicolae Brinza

Bug Description

Some tests crash on my Windows. I investigated the first one, the zorba/HigherOrder/hof-101,xq and Visual Studio reports a NULL pointer access in optimizer.
The callstack is:

 zorba_simplestore.dll!zorba::expr::get_expr_kind() Line 170 + 0x11 bytesC++
 zorba_simplestore.dll!zorba::ExprIterator::ExprIterator(zorba::expr * e) Line 81 + 0x8 bytesC++
 zorba_simplestore.dll!zorba::PrePostRewriteRule::apply(zorba::RewriterContext & rCtx, zorba::expr * curExpr, bool & modified) Line 46 + 0xf bytesC++
 zorba_simplestore.dll!zorba::RuleMajorDriver::rewrite(zorba::RewriterContext & rCtx) Line 59 + 0x55 bytesC++
>zorba_simplestore.dll!zorba::DefaultOptimizer::rewrite(zorba::RewriterContext & rCtx) Line 80 + 0xf bytesC++
 zorba_simplestore.dll!zorba::MarkExprs::apply(zorba::RewriterContext & rCtx, zorba::expr * node, bool & modified) Line 196 + 0x50 bytesC++
 zorba_simplestore.dll!zorba::MarkExprs::apply(zorba::RewriterContext & rCtx, zorba::expr * node, bool & modified) Line 162 + 0x25 bytesC++
 zorba_simplestore.dll!zorba::MarkExprs::apply(zorba::RewriterContext & rCtx, zorba::expr * node, bool & modified) Line 162 + 0x25 bytesC++
 zorba_simplestore.dll!zorba::MarkExprs::apply(zorba::RewriterContext & rCtx, zorba::expr * node, bool & modified) Line 162 + 0x25 bytesC++
 zorba_simplestore.dll!zorba::RuleMajorDriver::rewrite(zorba::RewriterContext & rCtx) Line 59 + 0x55 bytesC++
 zorba_simplestore.dll!zorba::DefaultOptimizer::rewrite(zorba::RewriterContext & rCtx) Line 98C++
 zorba_simplestore.dll!zorba::TranslatorImpl::end_visit(const zorba::InlineFunction & v, void * aState) Line 9397 + 0x50 bytesC++
 zorba_simplestore.dll!zorba::InlineFunction::accept(zorba::parsenode_visitor & v) Line 5639 + 0x1a bytesC++
 zorba_simplestore.dll!zorba::FunctionDecl::accept(zorba::parsenode_visitor & v) Line 871 + 0x35 bytesC++
 zorba_simplestore.dll!zorba::VFO_DeclList::accept(zorba::parsenode_visitor & v) Line 652 + 0x1d3 bytesC++
 zorba_simplestore.dll!zorba::Prolog::accept(zorba::parsenode_visitor & v) Line 252 + 0x35 bytesC++
 zorba_simplestore.dll!zorba::MainModule::accept(zorba::parsenode_visitor & v) Line 135 + 0x35 bytesC++
 zorba_simplestore.dll!zorba::translate_aux(zorba::TranslatorImpl * rootTranslator, const zorba::parsenode & root, zorba::static_context * rootSctx, short rootSctxId, zorba::ModulesInfo * minfo, const std::map<zorba::rstring<zorba::rstring_classes::rep<zorba::atomic_int,std::char_traits<char>,std::allocator<char> > >,zorba::rstring<zorba::rstring_classes::rep<zorba::atomic_int,std::char_traits<char>,std::allocator<char> > >,std::less<zorba::rstring<zorba::rstring_classes::rep<zorba::atomic_int,std::char_traits<char>,std::allocator<char> > > >,std::allocator<std::pair<zorba::rstring<zorba::rstring_classes::rep<zorba::atomic_int,std::char_traits<char>,std::allocator<char> > > const ,zorba::rstring<zorba::rstring_classes::rep<zorba::atomic_int,std::char_traits<char>,std::allocator<char> > > > > > & modulesStack, bool isLibModule) Line 12192 + 0x18 bytesC++
 zorba_simplestore.dll!zorba::translate(const zorba::parsenode & root, zorba::CompilerCB * ccb) Line 12227 + 0x2f bytesC++
 zorba_simplestore.dll!zorba::XQueryCompiler::normalize(zorba::rchandle<zorba::parsenode> aParsenode) Line 233 + 0x19 bytesC++
 zorba_simplestore.dll!zorba::XQueryCompiler::compile(zorba::rchandle<zorba::parsenode> ast) Line 107 + 0x1e bytesC++
 zorba_simplestore.dll!zorba::XQueryCompiler::compile(std::basic_istream<char,std::char_traits<char> > & aXQuery, const zorba::rstring<zorba::rstring_classes::rep<zorba::atomic_int,std::char_traits<char>,std::allocator<char> > > & aFileName) Line 149 + 0x1e bytesC++
 zorba_simplestore.dll!zorba::XQueryImpl::doCompile(std::basic_istream<char,std::char_traits<char> > & aQuery, const Zorba_CompilerHints & aHints, bool fork_sctx) Line 551 + 0x17 bytesC++
 zorba_simplestore.dll!zorba::XQueryImpl::compile(const zorba::String & aQuery, const zorba::SmartPtr<zorba::StaticContext> & aStaticContext, const Zorba_CompilerHints & aHints) Line 458C++
 testdriver.exe!main(int argc, char * * argv) Line 299 + 0x69 bytesC++
 testdriver.exe!__tmainCRTStartup() Line 555 + 0x19 bytesC
 testdriver.exe!mainCRTStartup() Line 371C

The NULL pointer is received in function PrePostRewriteRule::apply(...) in parameter curExpr.

Tags: optimizer

Related branches

Revision history for this message
Markos Zaharioudakis (markos-za) wrote :

The implementation of high order functions is not complete. This test is marked as expected to fail.

Revision history for this message
Sorin Marian Nasoi (sorin.marian.nasoi) wrote :

Marked with Resolution = None at Dana's request.

Revision history for this message
Markos Zaharioudakis (markos-za) wrote :

Nicolae, I am transfering this to you, since you are implementing the HOFs right now.

Changed in zorba:
assignee: Markos Zaharioudakis (markos-za) → Nicolae Brinza (nbrinza)
Changed in zorba:
milestone: none → 2.8
Changed in zorba:
milestone: 2.8 → 2.9
Revision history for this message
Nicolae Brinza (nbrinza) wrote :

Fixed in the trunk.

Changed in zorba:
status: New → Fix Committed
Changed in zorba:
status: Fix Committed → Fix Released
To post a comment you must log in.
This report contains Public information  
Everyone can see this information.

Other bug subscribers

Remote bug watches

Bug watches keep track of this bug in other bug trackers.