Project

Profile

Help

Bug #2107

closed

Byte code CannotCompileException for DoubleToInteger conversion

Added by O'Neil Delpratt almost 10 years ago. Updated over 9 years ago.

Status:
Closed
Priority:
Normal
Category:
Byte code generation
Sprint/Milestone:
-
Start date:
2014-07-18
Due date:
% Done:

100%

Estimated time:
Legacy ID:
Applies to branch:
Fix Committed on Branch:
Fixed in Maintenance Release:
Platforms:

Description

Bug reported by Gunther Rademacher:

When showing some more XQuery code to Saxon-EE with byte code

generation, I came across a CannotCompileException. My attempt

to create a minimal reproduction resulted in this:

 declare function local:f($done, $todo)
    {
      if (empty($todo)) then
        $done
      else
        local:f
        (
          (
            $done,
            1 to xs:integer($todo[1]/@n + 1)
          ),
          subsequence($todo, 2)
        )
    };
    local:f
    (
      (),
      (
        <x n="1"/>,
        <y n="2"/>
      )
    )

The stack trace is shown below.

com.saxonica.bytecode.util.CannotCompileException: 
	at com.saxonica.bytecode.converter.DoubleToIntegerCompiler.compileToPrimitive(DoubleToIntegerCompiler.java:49)
	at com.saxonica.bytecode.CastExpressionCompiler.compileToPrimitive(CastExpressionCompiler.java:67)
	at com.saxonica.bytecode.util.CompilerService.compileToPrimitive(CompilerService.java:794)
	at com.saxonica.bytecode.RangeExpressionCompiler.compileToIterator(RangeExpressionCompiler.java:59)
	at com.saxonica.bytecode.util.CompilerService.compileToIterator(CompilerService.java:716)
	at com.saxonica.bytecode.LetExpressionCompiler.compileCommonExpr(LetExpressionCompiler.java:455)
	at com.saxonica.bytecode.UserFunctionCallCompiler.compileFunctionCall(UserFunctionCallCompiler.java:68)
	at com.saxonica.bytecode.UserFunctionCallCompiler.compileToIterator(UserFunctionCallCompiler.java:23)
	at com.saxonica.bytecode.util.CompilerService.compileToIterator(CompilerService.java:716)
	at com.saxonica.bytecode.ChooseCompiler.compileToIterator(ChooseCompiler.java:43)
	at com.saxonica.bytecode.util.CompilerService.compileToIterator(CompilerService.java:716)
	at com.saxonica.bytecode.TailCallLoopCompiler.compileToIterator(TailCallLoopCompiler.java:21)
	at com.saxonica.bytecode.util.CompilerService.compileToIterator(CompilerService.java:716)
	at com.saxonica.bytecode.util.CompilerService.compileToByteCode(CompilerService.java:491)
	at com.saxonica.expr.ee.OptimizerEE.compileToByteCode(OptimizerEE.java:1363)
	at net.sf.saxon.query.XQueryFunction.optimize(XQueryFunction.java:506)
	at net.sf.saxon.query.XQueryFunctionLibrary.optimizeGlobalFunctions(XQueryFunctionLibrary.java:324)
	at net.sf.saxon.query.QueryModule.optimizeGlobalFunctions(QueryModule.java:1123)
	at net.sf.saxon.expr.instruct.Executable.fixupQueryModules(Executable.java:579)
	at net.sf.saxon.query.QueryParser.makeXQueryExpression(QueryParser.java:169)
	at net.sf.saxon.query.StaticQueryContext.compileQuery(StaticQueryContext.java:526)
	at net.sf.saxon.Query.compileQuery(Query.java:702)
	at net.sf.saxon.Query.doQuery(Query.java:332)
	at net.sf.saxon.Query.main(Query.java:107)
Actions #1

Updated by O'Neil Delpratt almost 10 years ago

  • Status changed from New to Resolved
  • % Done changed from 0 to 100

Added the code to compile t primitive type for DoubleToInteger conversion in the DoubleToIntegerCompiler class. Similar addition has been made in the FloatToIntegerCompiler class.

Actions #2

Updated by O'Neil Delpratt almost 10 years ago

Fixes have been applied to both the Saxon 9.5 and 9.6 branches.

Actions #3

Updated by O'Neil Delpratt over 9 years ago

  • Status changed from Resolved to Closed
  • Fixed in version set to 9.5.1.7

Bug fix applied in Saxon maintenance release 9.5.1.7

Please register to edit this issue

Also available in: Atom PDF