Project

Profile

Help

Bug #3316

closed

"Bad parent pointer" after simplifying nested blocks.

Added by Michael Kay over 7 years ago. Updated over 7 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:
Platforms:

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

Actions #1

Updated by Michael Kay over 7 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.

Actions #2

Updated by Michael Kay over 7 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
Actions #3

Updated by Michael Kay over 7 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.

Actions #4

Updated by Michael Kay over 7 years ago

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

Fixed on the 9.8 branch

Actions #5

Updated by O'Neil Delpratt over 7 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.

Actions #6

Updated by O'Neil Delpratt over 7 years ago

  • Status changed from Resolved to Closed

Please register to edit this issue

Also available in: Atom PDF