Project

Profile

Help

Bug #5913

closed

Tail recursion overwrites value of variable

Added by Martin Holmes almost 2 years ago. Updated about 1 year ago.

Status:
Resolved
Priority:
Normal
Assignee:
Category:
Internals
Sprint/Milestone:
-
Start date:
2023-03-08
Due date:
% Done:

80%

Estimated time:
Legacy ID:
Applies to branch:
10, 11, 12, trunk
Fix Committed on Branch:
10, 11, 12, trunk
Fixed in Maintenance Release:
Platforms:
.NET, Java

Description

Arising out of a question on Slack on March 7:

Attached is a zip with test.xsl and test.xspec. The XSLT contains two functions, one of which calls the other, and the second is recursive. The XSpec tests the functions with various inputs. The process runs fine when an xsl:message is present either in the first or second function, even if the xsl:message does not read or output the content of any variables, but if all xsl:messages are commented out, the process fails with this error:

XTTE0570 An empty sequence is not allowed as the value of variable $nextLetter

which is a result of accessing a position in the variable $candidateSequence; it seems that the $prevPos variable ends up being assigned a value of 90 at some point, which is a value it should never get. This may be the result of some confusion between the position in the letter sequence ('A' through 'Z', length 26) and the codepoint of the last letter 'Z', which would be 90.


Files

saxon_10_issue.zip (3.17 KB) saxon_10_issue.zip test.xsl with two functions; test.xspec with some tests for those functions. Martin Holmes, 2023-03-08 18:30

Please register to edit this issue

Also available in: Atom PDF