On 20/12/11 12:14, Rademacher, Gunther wrote:
An exception as stated in the subject line was thrown while 
running some pre-existing XQuery code on Saxon-HE 9.4.0.1J.

The shortest repro that I could come up with is this:


      declare function local:f($a, $b) as node()*
      {
        let $c := $a[1]
        return
          if (empty($a)) then
            $b
          else if ($c/self::y) then
            for $e at $i in $c/*
            where $i > 1 and $i < count($c/*)
            return $e
          else
            local:f($a[position() > 1], ($b, $c))
      };
    
      local:f(<x/>, ())


While reducing the original code, at one point I also saw a 

      java.lang.ArrayIndexOutOfBoundsException: 
      Local variable has not been allocated a stack frame slot

It can be reproduced by


      declare function local:f($a, $b) as node()*
      {
        let $c := $a[1]
        return
          if (empty($a)) then
            $b
          else
            local:f
            (
              $a[position() > 1],
              (
                $b,
                for $e at $i in $c/*
                where $i > 1 and $i < count($c/*)
                return $e
              )
            )
      };
      
      local:f(<u><v/><w/><y/></u>, ())


Best regards
Gunther








Software AG - Group Executive Board: Karl-Heinz Streibich (Vorsitzender/Chairman), Arnd Zinnhardt, Mark Edwards, Dr. Wolfram Jost, Kamyar Niroumand, Darren Roos, Jonathan Smith, Ivo Totev 

Sitz/Registered office: Uhlandstra?e 12, 64297 Darmstadt, Germany - Registergericht/Commercial register: Darmstadt HRB 1562 - Vorstand/Management Board: Karl-Heinz Streibich (Vorsitzender/Chairman), Dr. Wolfram Jost, Arnd Zinnhardt http://www.softwareag.com/


------------------------------------------------------------------------------
Write once. Port to many.
Get the SDK and tools to simplify cross-platform app development. Create 
new or port existing apps to sell to consumers worldwide. Explore the 
Intel AppUpSM program developer opportunity. appdeveloper.intel.com/join
http://p.sf.net/sfu/intel-appdev
_______________________________________________
saxon-help mailing list archived at http://saxon.markmail.org/
saxon-help@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/saxon-help 

thanks again Gunther for reporting this bug. A fix has been applied (reference on bugzilla ID: 3464429 : https://sourceforge.net/tracker/?func=detail&aid=3464429&group_id=29872&atid=397617) which will appear in the next build of Saxon.

kind regards,

--
O'Neil Delpratt
Software Developer, Saxonica Limited
Email: oneil@saxonica.com
Tel: +44 118 946 5894
Web: http://www.saxonica.com