Bug #4642

-TP option fails with XQuery

Added by Michael Kay about 1 year ago. Updated 11 months ago.

Start date:
Due date:
% Done:


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



#1 Updated by Michael Kay about 1 year ago

It's failed at line 16 executing (1 to $number-of-cols) ! <col>{$col-value}</col>

Because the expression (1 to $number-of-cols) occurs in a loop and is invariant over the loop, it's been bound to a system-allocated local variable, but no slot for this variable has been allocated on the stack.

#2 Updated by Michael Kay about 1 year ago

It's evaluating variable $m1 (the function call to local:make-rows() has been inlined. The variable (internally, a GlobalParam has a null stackframeMap.

Allocation of slots to local variables happens in GlobalVariable.typeCheck(), called from Executable.typeCheckGlobalVariables(). At this the function call has already been inlined, but loop-lifting has not yet taken place, so there are no local variables.

The problem appears to be that the ComponentTracer expression (injected by virtue of the -TP option) is not doing a deep copy during function inlining -- only a shallow copy -- which means that after inlining, a subtree is shared between the original function and the inlined copy, which invalidates slot number allocation.

#3 Updated by Michael Kay about 1 year ago

  • Category set to Diagnostics
  • Status changed from New to Resolved
  • Priority changed from Low to Normal
  • Applies to branch 10, trunk added
  • Fix Committed on Branch 10, trunk added

#4 Updated by O'Neil Delpratt 11 months ago

  • % Done changed from 0 to 100
  • Fixed in Maintenance Release 10.2 added

Bug fix applied in the Saxon 10.2 maintenance release.

#5 Updated by O'Neil Delpratt 11 months ago

  • Status changed from Resolved to Closed

Please register to edit this issue

Also available in: Atom PDF