[Issue 3147] New: Incorrect value range propagation for addition

d-bugmail at puremagic.com d-bugmail at puremagic.com
Mon Jul 6 22:50:38 PDT 2009


http://d.puremagic.com/issues/show_bug.cgi?id=3147

           Summary: Incorrect value range propagation for addition
           Product: D
           Version: unspecified
          Platform: Other
        OS/Version: Linux
            Status: NEW
          Severity: normal
          Priority: P2
         Component: DMD
        AssignedTo: nobody at puremagic.com
        ReportedBy: andrei at metalanguage.com


This code doesn't compile and it should:

void main()
{
    byte x, y, z;
    short a = x+y;
}

Although the manifest type of x+y is int, the actual range of x+y, regardless
of the values of x and y, is -byte.min-byte.min to byte.max+byte.max. That
range fits properly in a short so the compiler should let the code go through.

-- 
Configure issuemail: http://d.puremagic.com/issues/userprefs.cgi?tab=email
------- You are receiving this mail because: -------


More information about the Digitalmars-d-bugs mailing list