Uploaded image for project: 'Daffodil'
  1. Daffodil
  2. DAFFODIL-2065

Incorrectly attempting to cast signed to unsigned type

    XMLWordPrintableJSON

Details

    • Bug
    • Status: Closed
    • Major
    • Resolution: Fixed
    • 2.2.0
    • 2.4.0
    • Back End
    • None
    • Ubuntu 18.04.1 LTS

    Description

      When adding a signed and unsigned type, Daffodil attempts to cast the signed value to unsigned. The correct behaviour would be to cast the unsigned to signed.

      When running the attached schema on an empty file, the following error is produced:

      [error] Schema Definition Error: Cannot convert '-1' from Long type to UnsignedInt (Negative value -1 cannot be converted to an unsigned int.).
      Schema context: element reference tns:x Location line 3 in file:/home/bsloane/Documents/incubator-daffodil/test/test.dfdl.xsd

      The relevent piece of schema is:

      <xs:element name="x" type="xs:int" dfdl:inputValueCalc="{ xs:unsignedInt(1) + (-1) }" />

      Attachments

        1. test.dfdl.xsd
          2 kB
          Brandon Sloane

        Activity

          People

            dfthompson Dave Thompson
            brandon.sloane Brandon Sloane
            Votes:
            0 Vote for this issue
            Watchers:
            3 Start watching this issue

            Dates

              Created:
              Updated:
              Resolved: