﻿id	summary	reporter	owner	description	type	status	priority	milestone	component	version	resolution	keywords	cc	difficulty
823	arithmetic-shift fails in extreme cases	sjamaan		"I don't know whether it's worth the trouble to fix this, but I'll put it on here so at least it's documented.

{{{(arithmetic-shift -123 most-negative-fixnum) => -123}}}

This should be {{{-1}}}. It fails because in chicken.h the {{{C_i_fixnum_arithmetic_shift}}} function calls {{{C_fixnum_shift_right}}} with the negated value of the shift amount.  This overflows and wraps around to zero.

Fixing it would be simplest by just inlining the shift and negating _after_ unboxing.  This is easy, but there are some other places that call {{{C_fixnum_shift_right}}} in this way.

This code is obviously wrong but I'm not sure it's worth fixing, since it's such an extreme edge case (if you subtract 1 from the shift amount you get an error that the argument is not a fixnum). On the other hand, not fixing it just seems, I dunno... lazy and possibly dangerous. :)"	defect	closed	minor	4.10.0	core libraries	4.7.x	fixed	edge cases, numbers, shifting, overflow		
