[bug] erl_interface-3.6.5: C library erl_marshal, function erl_decode

Alexander Demidenko <>
Wed Jun 23 11:43:27 CEST 2010


Hi!
I found incorrect behavior of the function.
Easiest way to demonstrate in the following example:
dummy C code:

*
*

*    byte * bb = new byte[10000];
    ETERM* t = erl_mk_int(-1250947744);
    erl_encode(t, bb);
    ETERM* d = erl_decode(bb);
    DBGTERM("Result: ", d);*


Output:
*12:52:11 : Result: -1250947745*

*
*

Some strange in function decode_long, while converting long to ulong:

*long n = -((long)u);*

instead: *not R, inc R,*

compiler generate: *not R, or R, 1*

*I suspect that the problem in compiler optimization options.*

I found same bug in binary erl_interface by:

Erlang R13B01 (erts-5.7.2) from standart ubuntu lucid repository.

Erlang R13B04 (erts-5.7.5) from deb
http://ppa.launchpad.net/erlang-dev/ppa/ubuntu karmic main



-- 
---------------------------------------------
With best regards,
Alexander.


More information about the erlang-bugs mailing list