Bug #2181
closedTry/catch within a loop gives wrong output
100%
Description
Gunther Rademacher reports on saxon:help
Additionally, I have observed a strange result from this one:
try {parse-xml("p1")} catch * {$err:code},
try {parse-xml("p2")} catch * {$err:code},
for $p in ("p1", "p2") return
try {parse-xml($p)} catch * {$err:code}
It returns just two error codes
err:FODC0006 err:FODC0006
though the console log indicates four failures:
Error on line 1 column 1
SXXP0003: Error reported by XML parser: Content is not allowed in prolog.
Error on line 1 column 1
SXXP0003: Error reported by XML parser: Content is not allowed in prolog.
Error on line 1 column 1
SXXP0003: Error reported by XML parser: Content is not allowed in prolog.
Error on line 1 column 1
SXXP0003: Error reported by XML parser: Content is not allowed in prolog.
Updated by Michael Kay about 10 years ago
Added QT3 test case try-catch-err-code-variable-14.
What's happening here is that the reference to $err:code is being turned into an internal function call, and the internal function call is then being loop-lifted out of the "for" loop as it's not recognized as having a dependency on the range variables of the loop expression.
Updated by Michael Kay about 10 years ago
- Subject changed from Incorrect try/catch output to Try/catch within a loop gives wrong output
Updated by Michael Kay about 10 years ago
- Status changed from New to Resolved
- Found in version set to 9.6
Patch produced for 9.7, 9.6 and 9.5 branches: the DynamicErrorInfo is marked as having side-effects, to prevent it being loop-lifted out of its try/catch scope.
Updated by O'Neil Delpratt about 10 years ago
Bug fix applied to the Saxon maintenance release 9.5.1.8
Saxon 9.6 pending
Updated by O'Neil Delpratt about 10 years ago
- Status changed from Resolved to Closed
- % Done changed from 0 to 100
- Fixed in version set to 9.6.0.2
Bug fix applied to the maintenance release Saxon 9.6.0.2
Updated by O'Neil Delpratt almost 9 years ago
- Sprint/Milestone set to 9.6.0.2
- Applies to branch 9.6 added
- Fix Committed on Branch 9.6 added
- Fixed in Maintenance Release 9.6.0.2 added
Please register to edit this issue