Bug #3316
closed
"Bad parent pointer" after simplifying nested blocks.
Fix Committed on Branch:
9.8
Fixed in Maintenance Release:
Description
Given the following template rule:
<xsl:template name="t" as="node()*">
<xsl:param name="e" as="element()?"/>
<xsl:sequence select="$e, $e"/>
</xsl:template>
we get several "Bad parent pointer found" warning messages during compilation.
Originally raised here: https://saxonica.plan.io/boards/3/topics/6838?r=6841
Internally, Saxon represents both a sequence constructor and a comma-expression as a "Block" expression, so the initial structure of the expression tree here is
Block(Param, Block($e, $e))
The simplify() operation on a Block flattens any nested blocks, so this is reduced to:
Block(Param $e, $e)
It seems that this flattening operation is not resetting parent pointers on the 3 child expressions to the new flattened Block.
- Description updated (diff)
- Category set to Internals
- Assignee set to Michael Kay
- Priority changed from Low to Normal
- Applies to branch 9.8 added
XSLTemplate.refineTemplateBody() is doing
Expression result = body.simplify();
which modifies the subexpressions of body to point to "result" as the new parent; this means that the tree underneath "body" is no longer valid.
But then (on this particular path) it is subsequently doing
result = typeCheck(body);
which uses the original tree rather than the simplified tree as input.
- Status changed from New to Resolved
- Fix Committed on Branch 9.8 added
- % Done changed from 0 to 100
- Fixed in Maintenance Release 9.8.0.3 added
Bug fix applied in the Saxon 9.8.0.3 maintenance release.
- Status changed from Resolved to Closed
Please register to edit this issue
Also available in: Atom
PDF