The second query is a bug in the optimizer, see stack below. I'm assigning this to Markos while I'm still working on the first query.
==6659== Memcheck, a memory error detector ==6659== Copyright (C) 2002-2011, and GNU GPL'd, by Julian Seward et al. ==6659== Using Valgrind-3.7.0 and LibVEX; rerun with -h for copyright info ==6659== Command: ./zorba/build/bin/zorba -f -q e.xq ==6659== ==6659== Invalid read of size 8 ==6659== at 0x56F2FA4: zorba::store::Item::isError() const (item.h:177) ==6659== by 0x56F1368: zorba::execute(zorba::CompilerCB*, zorba::expr*, zorba::store::ItemHandle<zorba::store::Item>&) (fold_rules.cpp:483) ==6659== by 0x56F0FEB: zorba::FoldConst::apply(zorba::RewriterContext&, zorba::expr*, bool&) (fold_rules.cpp:408) ==6659== by 0x56DB24D: zorba::RuleMajorDriver::rewrite(zorba::RewriterContext&) (rule_driver.cpp:63) ==6659== by 0x56DC85E: zorba::DefaultOptimizer::rewrite(zorba::RewriterContext&) (default_optimizer.cpp:95) ==6659== by 0x57190E9: zorba::XQueryCompiler::optimize(zorba::expr*) (compiler_api.cpp:375) ==6659== by 0x5718D2B: zorba::XQueryCompiler::compile(zorba::rchandle<zorba::parsenode> const&, bool, unsigned long&, zorba::audit::ScopedRecord&) (compiler_api.cpp:275) ==6659== by 0x5718BAB: zorba::XQueryCompiler::compile(std::istream&, zorba::rstring<zorba::rstring_classes::rep<zorba::atomic_int, std::char_traits<char>, std::allocator<char> > > const&, unsigned long&) (compiler_api.cpp:241) ==6659== by 0x549A4E2: zorba::XQueryImpl::doCompile(std::istream&, Zorba_CompilerHints const&, bool, unsigned long&) (xqueryimpl.cpp:611) ==6659== by 0x549A054: zorba::XQueryImpl::compile(std::istream&, zorba::SmartPtr<zorba::StaticContext> const&, Zorba_CompilerHints const&) (xqueryimpl.cpp:540) ==6659== by 0x415341: compileAndExecute(zorba::Zorba*, ZorbaCMDProperties const&, zorba::SmartPtr<zorba::StaticContext>&, std::string const&, std::istream&, std::ostream&, TimingInfo&) (zorbacmd.cpp:770) ==6659== by 0x416CFD: main (zorbacmd.cpp:1201) ==6659== Address 0x10 is not stack'd, malloc'd or (recently) free'd ==6659==
The second query is a bug in the optimizer, see stack below. I'm assigning this to Markos while I'm still working on the first query.
==6659== Memcheck, a memory error detector build/bin/ zorba -f -q e.xq store:: Item::isError( ) const (item.h:177) execute( zorba:: CompilerCB* , zorba::expr*, zorba:: store:: ItemHandle< zorba:: store:: Item>&) (fold_rules. cpp:483) FoldConst: :apply( zorba:: RewriterContext &, zorba::expr*, bool&) (fold_rules. cpp:408) RuleMajorDriver ::rewrite( zorba:: RewriterContext &) (rule_driver. cpp:63) DefaultOptimize r::rewrite( zorba:: RewriterContext &) (default_ optimizer. cpp:95) XQueryCompiler: :optimize( zorba:: expr*) (compiler_ api.cpp: 375) XQueryCompiler: :compile( zorba:: rchandle< zorba:: parsenode> const&, bool, unsigned long&, zorba:: audit:: ScopedRecord& ) (compiler_ api.cpp: 275) XQueryCompiler: :compile( std::istream& , zorba:: rstring< zorba:: rstring_ classes: :rep<zorba: :atomic_ int, std::char_ traits< char>, std::allocator< char> > > const&, unsigned long&) (compiler_ api.cpp: 241) XQueryImpl: :doCompile( std::istream& , Zorba_CompilerHints const&, bool, unsigned long&) (xqueryimpl. cpp:611) XQueryImpl: :compile( std::istream& , zorba:: SmartPtr< zorba:: StaticContext> const&, Zorba_CompilerHints const&) (xqueryimpl. cpp:540) te(zorba: :Zorba* , ZorbaCMDProperties const&, zorba:: SmartPtr< zorba:: StaticContext> &, std::string const&, std::istream&, std::ostream&, TimingInfo&) (zorbacmd.cpp:770)
==6659== Copyright (C) 2002-2011, and GNU GPL'd, by Julian Seward et al.
==6659== Using Valgrind-3.7.0 and LibVEX; rerun with -h for copyright info
==6659== Command: ./zorba/
==6659==
==6659== Invalid read of size 8
==6659== at 0x56F2FA4: zorba::
==6659== by 0x56F1368: zorba::
==6659== by 0x56F0FEB: zorba::
==6659== by 0x56DB24D: zorba::
==6659== by 0x56DC85E: zorba::
==6659== by 0x57190E9: zorba::
==6659== by 0x5718D2B: zorba::
==6659== by 0x5718BAB: zorba::
==6659== by 0x549A4E2: zorba::
==6659== by 0x549A054: zorba::
==6659== by 0x415341: compileAndExecu
==6659== by 0x416CFD: main (zorbacmd.cpp:1201)
==6659== Address 0x10 is not stack'd, malloc'd or (recently) free'd
==6659==