Add Dword to int (V.2.2.1 - Vulcan.Dialect)

This forum is meant for questions and discussions about the X# language and tools
Post Reply
Posts: 93
Joined: Thu Oct 25, 2018 11:39 am

Add Dword to int (V.2.2.1 - Vulcan.Dialect)

Post by Thomas »

Hi all,

We have problems with some mathematical calculations.
If I add a dword to an integer (less than 0) and assign the result to a usual then I get an overflow.

Code: Select all

    METHOD Test_CastUsualToInt() AS VOID STRICT

        LOCAL Number1           AS INT
        LOCAL Number2AsDword	AS DWORD
        LOCAL Number2AsInt      AS INT
        LOCAL Summe1            AS USUAL
        LOCAL Summe2            AS USUAL
        LOCAL Summe3            AS INT
        LOCAL Summe4            AS INT
        Number1 := -55
        Number2AsDword := 1
        Number2AsInt := 1
        Summe1 := Number1 + Number2AsDword   <==  Summe1 = {4294967242} (Float) ???
        Summe2 := Number1 + Number2AsInt
        Summe3 := Number1 + Number2AsDword
        Summe4 := Number1 + Number2AsInt
        Assert.Equal((int)Summe1, -54)      <== fails:  actual value -2147483648
        Assert.Equal((int)Summe2, -54)
        Assert.Equal(Summe3, -54)
        Assert.Equal(Summe4, -54)

Could you please check this.

User avatar
Posts: 4584
Joined: Thu Oct 08, 2015 7:48 am
Location: Greece

Add Dword to int (V.2.2.1 - Vulcan.Dialect)

Post by Chris »

Thanks Thomas, problem is that the INT+DWORD operation results to a DWORD instead of IN, and this is incompatible to both VO and Vulcan. Will open a report about this.
Chris Pyrgas

XSharp Development Team test
Post Reply