[Issue 9107] New: Value Range Analysis with uint and byte

d-bugmail at puremagic.com d-bugmail at puremagic.com
Sun Dec 2 12:24:20 PST 2012


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

           Summary: Value Range Analysis with uint and byte
           Product: D
           Version: D2
          Platform: x86
        OS/Version: Windows
            Status: NEW
          Keywords: diagnostic
          Severity: normal
          Priority: P2
         Component: DMD
        AssignedTo: nobody at puremagic.com
        ReportedBy: bearophile_hugs at eml.cc


--- Comment #0 from bearophile_hugs at eml.cc 2012-12-02 12:24:19 PST ---
Maybe this shows a problem of the Value Range Analysis, DMD 2.061alpha;


void main(string[] args) {
    int a1 = 198 + args.length; // A run-time value.
    byte b1 = a1 % 200;  // error, OK.

    uint a2 = 198 + args.length;
    ubyte b2 = a2 % 200;  // no error, good.
    byte b3 = a2 % 200;  // no error, bad.
}


test.d(3): Error: cannot implicitly convert expression (a1 % 200) of type int
to byte

-- 
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