Project

Profile

Help

Bug #1431

Null pointer exception involving common subexpression optimization?

Added by Michael Kay over 9 years ago. Updated about 9 years ago.

Status:
Closed
Priority:
Normal
Assignee:
Category:
Byte code generation
Sprint/Milestone:
-
Start date:
2012-03-06
Due date:
% Done:

100%

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

Description

I've attached a fragment of a much larger program. This fragmentary program, test.xsl,

-. compiles properly with java net.sf.saxon.Transform, under standard optimization levels

-. compiles properly with the Saxon-EE 9.4.0.1N transform.exe utility, with the -opt:9 flag

-. throws a NullPointerException when compiled with the Saxon-EE 9.4.0.1N transform.exe

utility, with the standard optimization level(-opt:10)

The command used to compile this program and the associated error message are as follows:

C:\svn_fas\trunk\FAS2\activities database\implementations\SQL Server\schema preprocessing>transform -xsl:test.xsl test.xsd -o:newtest.xsd

Failed while compiling function null

java.lang.NullPointerException

    at com.saxonica.bytecode.util.CompilerService$ObjectIdentityWrapper.hashCode(CompilerService.java:196)

    at java.lang.Object.hashCode(map.xml)

    at java.util.HashMap.get(HashMap.java:317)

    at com.saxonica.bytecode.util.CompilerService.allocateStaticVariableInfo(CompilerService.java:872)

    at com.saxonica.bytecode.ExpressionCompiler.allocateStatic(ExpressionCompiler.java:408)

    at com.saxonica.bytecode.LetExpressionCompiler.compileCommonExpr(LetExpressionCompiler.java:176)

    at com.saxonica.bytecode.LetExpressionCompiler.compileToPush(LetExpressionCompiler.java:67)

    at com.saxonica.bytecode.util.CompilerService.compileToPush(CompilerService.java:671)

    at com.saxonica.bytecode.LetExpressionCompiler.compileToPush(LetExpressionCompiler.java:75)

    at com.saxonica.bytecode.util.CompilerService.compileToPush(CompilerService.java:671)

    at com.saxonica.bytecode.util.CompilerService.compileToByteCode(CompilerService.java:591)

    at com.saxonica.expr.ee.OptimizerEE.compileToByteCode(OptimizerEE.java:1322)

    at net.sf.saxon.style.XSLTemplate.optimize(XSLTemplate.java:454)

    at net.sf.saxon.style.PrincipalStylesheetModule.compileStylesheet(PrincipalStylesheetModule.java:809)

    at net.sf.saxon.PreparedStylesheet.setStylesheetDocument(PreparedStylesheet.java:360)

    at net.sf.saxon.PreparedStylesheet.prepare(PreparedStylesheet.java:207)

    at net.sf.saxon.PreparedStylesheet.compile(PreparedStylesheet.java:107)

    at net.sf.saxon.Transform.doTransform(Transform.java:559)

    at cli.Saxon.Cmd.DotNetTransform.Main(Unknown Source)

Error

java.lang.NullPointerException

Failed to compile stylesheet. 1 error detected.

This error should be reproducible with any well-formed test.xsd schema.

A key statement in this program appears to be the following:

    <xsl:value-of select="((some $p in $paths-for-type satisfies 

                               'summary' eq 

                                    $activity-specification-list/activity-specification[path-to-activity-root = $p]/activity-type)

                           and 

                           (some $p in $paths-for-type satisfies 

                               'summary' ne 

                                    $activity-specification-list/activity-specification[path-to-activity-root = $p]/activity-type))"

    />

The statement, which was originally in an xsl:when's "test" attribute, attempts to check for inconsistencies

in the $activity-specification-list table. If one removes either of the "some" clauses, the program compiles.

History

#1 Updated by Community Admin over 9 years ago

The problem occurs on 9.4.0.1N, but not on 9.4.0.1J, nor on 9.4.0.3N. It's an odd one, because there seems to be no .NET specific code on the stack trace, My guess is that it's some code generation problem that was present in IKVM 0.46.0.1 which was fixed in 0.46.0.2.

Since it's fixed in the current maintenance release, I don't propose to investigate the detailed cause.

(added by mkay)

#2 Updated by Community Admin over 9 years ago

Could you try this using 9.4.0.3 please? I think it is a problem that has been fixed.

(added by mkay - before previous entry)

#3 Updated by Michael Kay over 9 years ago

  • Status changed from New to Resolved
  • Fixed in version set to 9.4.0.3

#4 Updated by Michael Kay about 9 years ago

  • Status changed from Resolved to Closed
  • % Done changed from 0 to 100

Please register to edit this issue

Also available in: Atom PDF