[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:33:09 PDT 2011


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



--- Comment #7 from Steven Schveighoffer <schveiguy at yahoo.com> 2011-07-13 13:27:56 PDT ---
(In reply to comment #6)
> 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'.

I was taking this into account.

if the divisor is zero, you get a floating point exception (i.e. SIGFPE), so
VRP is able to safely use [-1, 1] as the range.

Technically, the set of possible values is [1, -1, undefined], and we can
simply ignore the undefined part for VRP.

Indeed the example is quite questionable, but I suppose if you know none of the
values are 0, it's valid code.

In any case, I don't think VRP is the answer to the problem.

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