Infinite recursion at compile time
The Saxon XSLT and XQuery processor, developed by Saxonica
Brought to you by:
mhkay
When the optimizer rewrites an expression, it then
calls itself recursively to apply further optimization
to the rewritten expression. This creates the risk of
an infinite regression if the various rewrites are not
convergent.
An example of this occurs in Saxon 8.6.1 with the query
for $v in 'abc'
return <e/>/text {$v}
One optimization step is unnecessarily adding an
atomization of the operand $v; the next step is
removing it, and this continues ad infinitum.
Source fix: in
net.sf.saxon.instruct.SimpleNodeConstructor, method
typeCheck(), at line 83, change this code:
if (select.getItemType(th).isAtomicType()) { select = new Atomizer(select,
env.getConfiguration());
}
to read:
if (!select.getItemType(th).isAtomicType()) { select = new Atomizer(select,
env.getConfiguration());
}
Michael Kay