Project

Profile

Help

Bug #3316

"Bad parent pointer" after simplifying nested blocks.

Added by Michael Kay about 3 years ago. Updated about 3 years ago.

Status:
Closed
Priority:
Normal
Assignee:
Category:
Internals
Sprint/Milestone:
-
Start date:
2017-06-28
Due date:
% Done:

100%

Estimated time:
Legacy ID:
Applies to branch:
9.8
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

History

#1 Updated by Michael Kay about 3 years ago

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.

#2 Updated by Michael Kay about 3 years ago

  • Description updated (diff)
  • Category set to Internals
  • Assignee set to Michael Kay
  • Priority changed from Low to Normal
  • Applies to branch 9.8 added

#3 Updated by Michael Kay about 3 years ago

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.

#4 Updated by Michael Kay about 3 years ago

  • Status changed from New to Resolved
  • Fix Committed on Branch 9.8 added

Fixed on the 9.8 branch

#5 Updated by O'Neil Delpratt about 3 years ago

  • % 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.

#6 Updated by O'Neil Delpratt about 3 years ago

  • Status changed from Resolved to Closed

Please register to edit this issue

Also available in: Atom PDF