[m-dev.] diff: additions to const_prop.m
Simon Taylor
stayl at cs.mu.OZ.AU
Tue Mar 30 17:55:08 AEST 1999
> Hmm, this seems to be shifting undefined behaviour at run-time
> into undefined behaviour at compile time, which is not a good thing.
> Note that undefined behaviour can include reporting an error
> or crashing (note the difference between undefined behaviour
> and unspecified result).
>
> I think the same comment applies to your recent change to vn_util.m,
> which also does the same optimization.
That is also true of overflow, which is not checked for in
const_prop.m or vn_util.m either.
> One way to avoid the problem would be to use the checked versions
> `<<' and `>>'.
Even though the behaviour is not defined, it would be nicer if it is
the same whether the call is optimized or not.
> Another way would be to check that the shift count
> is in range and to not perform the optimization if it isn't
> (thus leaving the undefined behaviour at runtime).
This is probably the best thing to do.
Simon.
More information about the developers
mailing list