[Issue 6000] New: Value range propagation does not work with modulus (%) with a constant

d-bugmail at puremagic.com d-bugmail at puremagic.com
Sat May 14 08:09:07 PDT 2011


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

           Summary: Value range propagation does not work with modulus (%)
                    with a constant
           Product: D
           Version: D2
          Platform: Other
        OS/Version: Mac OS X
            Status: NEW
          Keywords: rejects-valid
          Severity: normal
          Priority: P2
         Component: DMD
        AssignedTo: nobody at puremagic.com
        ReportedBy: kennytm at gmail.com


--- Comment #0 from kennytm at gmail.com 2011-05-14 08:05:03 PDT ---
Test case:

---------------------------------
void main() {
    ulong t;
    uint v = t & 15;    // ok
    uint u = t % 16;    // error?
}
---------------------------------
x.d(4): Error: cannot implicitly convert expression (t % 16LU) of type ulong to
uint
---------------------------------

There should not be error. The range of "t % 16" is entirely within [0, 15]
which is inside an "uint".

(See also bug 3147)

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