[racket-dev] Potential Constant Propagation Bug

From: Vincent St-Amour (stamourv at ccs.neu.edu)
Date: Fri Mar 29 16:21:49 EDT 2013

I have found what I think may be a bug in Racket's constant propagation:

   (unsafe-fx* 0 (error 'foo))

does not throw and error and evaluates to 0. If 0 is replaced with
another value, or if it's `read' in, the error is thrown.
`unsafe-fxquotient' has the same issue.

On the one hand, this is an unsafe operation, so maybe I shouldn't
expect the error to be thrown. On the other hand, I would expect
effectful arguments to functions to be evaluated no matter what.

Is this a bug, or is this the desired behavior for unsafe operations?

Vincent

Posted on the dev mailing list.