Erlang Mailing Lists

Author Message

<  Erlang bugs mailing list  ~  [bug] erl_interface-3.6.5: C library erl_marshal, function e

Guest
Posted: Wed Jun 23, 2010 9:43 am Reply with quote
Guest
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.


Post received from mailinglist
Guest
Posted: Tue Jun 29, 2010 9:56 am Reply with quote
Guest
Alexander Demidenko wrote:
> 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*
>
> *
> *
>
>
>
> *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
>
>
Thanks for reporting. The compiler was innocent, it did as it was told.

Here's a quick patch:

diff --git a/lib/erl_interface/src/legacy/erl_marshal.c
b/lib/erl_interface/src/legacy/erl_marshal.c
index c57c552..ab1953a 100644
--- a/lib/erl_interface/src/legacy/erl_marshal.c
+++ b/lib/erl_interface/src/legacy/erl_marshal.c
@@ -747,14 +747,11 @@ static ETERM *erl_decode_it(unsigned char **ext)
return ep;
} else if (arity == 4 && !((*ext)[3] & 0x80)) {
/* It will fit into an int !!
- * Note: It comes in "one's-complement notation"
*/
+ i = (int) (((*ext)[3] << 24) | ((*ext)[2])<< 16 |
+ ((*ext)[1]) << 8 | (**ext));
if (sign)
- i = (int) (~(((*ext)[3] << 24) | ((*ext)[2])<< 16 |
- ((*ext)[1]) << 8 | (**ext)) | (unsigned
int) sign);
- else
- i = (int) (((*ext)[3] << 24) | ((*ext)[2])<< 16 |
- ((*ext)[1]) << 8 | (**ext));
+ i = -i;
ERL_TYPE(ep) = ERL_INTEGER;
ep->uval.ival.i = i;
*ext += arity;




/Sverker, Erlang/OTP


________________________________________________________________
erlang-bugs (at) erlang.org mailing list.
See http://www.erlang.org/faq.html
To unsubscribe; mailto:erlang-bugs-unsubscribe@erlang.org

Post received from mailinglist
wailian
Posted: Tue Mar 20, 2012 2:46 am Reply with quote
Guest
One of them is the Ugg bailey button boot which has classic and uniquely designed buttons on its body to give that elegant and luxurious look. It has a fantastic look and this includes the Bailey Triplet Boot which has 3 buttons. These boots have a shaft (the upper part of the boot) which can be turned up or turned down depending upon your need. These buttons are both for style or decoration along with being functional or usable as well.

Display posts from previous:  

All times are GMT
Page 1 of 1
This forum is locked: you cannot post, reply to, or edit topics.

Jump to:  

You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum
You cannot attach files in this forum
You cannot download files in this forum