Brandon Sloane created DAFFODIL-2125:
----------------------------------------
Summary: Incorrect unsparse with suspensions and changing bitOrder
Key: DAFFODIL-2125
URL: https://issues.apache.org/jira/browse/DAFFODIL-2125
Project: Daffodil
Issue Type: Bug
Reporter: Brandon Sloane
Attachments: input.bin, input.bin.xml, input.bin.xml.bin,
schema.dfdl.xsd
Full example attached demonstrating the round trip behaviour of schema.dfdl.xsd.
Relevent schema is:
{quote}<xs:sequence>
<xs:element name="zero" type="xs:int" dfdl:length="8" dfdl:outputValueCalc="\{
../body/zero }"
dfdl:bitOrder="mostSignificantBitFirst" dfdl:byteOrder="bigEndian"
/>
<xs:element name="body" dfdl:lengthKind="implicit">
<xs:complexType>
<xs:sequence>
<xs:element name="a" type="xs:int" dfdl:length="4"/>
<xs:element name="b" type="xs:int" dfdl:length="4" dfdl:outputValueCalc="\{
../zero }"/>
<xs:element name="zero" type="xs:int" dfdl:inputValueCalc="\{ 0 }"/>
</xs:sequence>
</xs:complexType>
</xs:element>
</xs:sequence>
{quote}
Note that there are 2 suspensions involved in unparsing the above. The first
byte, and second nimble of the second byte both suspend until the last element
is computed.
Also note that the bit-order changes between byte 1 and 2.
Given the input:
{quote}<tns:root xmlns:tns="urn:example">
<zero>0</zero>
<body>
<a>2</a>
<b>0</b>
<zero>0</zero>
</body>
</tns:root>
{quote}
We expect unparse to reproduce input.bin exactly:
{quote}00 02
{quote}
But instead see:
{quote}00 00
{quote}
As if something is clobbering the value of <a>
--
This message was sent by Atlassian JIRA
(v7.6.3#76005)