Bug in erl_interface in R9C?

Kent Boortz <>
Mon Aug 25 01:27:41 CEST 2003


Javier París Fernández <> writes:
> I think there's a bug in ei_decode_longlong when decoding integers bigger
> than 2^32.
> 
> --- otp_src_R9C-0/lib/erl_interface/src/decode/decode_longlong.c~       2003-08-20 18:01:54.000000000 +0200
> +++ otp_src_R9C-0/lib/erl_interface/src/decode/decode_longlong.c        2003-08-20 18:19:18.000000000 +0200
> @@ -51,7 +51,7 @@
>         int pos, shift = 0;
>         n = 0;
>         for (pos = 0; pos < arity; pos++) {
> -           n |= get8(s) << shift;
> +           n |= ((EI_LONGLONG) get8(s)) << shift;
>             shift += 8;
>         }
>      }
> 
> The result of get8(s) << shift is an integer, but when the shift makes the
> number bigger than 2^32 the remaining bits are discarded. Putting a cast
> to force the result to be 64 bits solves the problem.

Thank you for reporting this. The bug has been added to our internal
bug tracking system (OTP-4784) and will be corrected in R9C-1,

kent



More information about the erlang-questions mailing list