[Issue 2434] Need a way to add casts into array operations.

d-bugmail at puremagic.com d-bugmail at puremagic.com
Wed Jul 13 13:14:39 PDT 2011


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



--- Comment #6 from kennytm at gmail.com 2011-07-13 13:09:26 PDT ---
(In reply to comment #5)
> Hm, I take it back.  This doesn't compile on D2, so maybe range propagation
> isn't smart enough.
> 

There is no way VRP will support this. After the statement 'int x = 1', the
information that 'x == 1' is lost. We don't have data flow analysis. So in the
expression '1 / x', x is treated as having the complete range of 'int'.

In the current implementation of VRP, since the divisor contains 0, the result
will be the complete range, so '1 / x' still gives the complete range of 'int',
not [-1, 1].

</off-topic>

> int x = 1;
> byte b = 1 / x;
> 
> Same error reported
> 
> Now I really don't know why D2 passes the array operation...
> 
> I still think the right solution is allowing casting in an array expression.

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