Wrong result of erl_compare_ext for lists
Evgeny Khirin
evgeny.khirin@REDACTED
Fri Nov 19 09:11:40 CET 2010
Hi,
Function erl_compare_ext of erl_interface library returns 1 instead -1 when
comparing lists like [0] and [0, 1000].
The patch below fixes the problem for R12B5. Current Erlang sources still have
the bug.
Regards,
Evgeny.
=== modified file 'otp_src_R12B-5/lib/erl_interface/src/legacy/erl_marshal.c'
--- otp_src_R12B-5/lib/erl_interface/src/legacy/erl_marshal.c 2009-12-18
11:49:04 +0000
+++ otp_src_R12B-5/lib/erl_interface/src/legacy/erl_marshal.c 2010-11-17
13:35:52 +0000
@@ -1530,8 +1530,11 @@
min = (i < j) ? i : j;
k = 0;
while (1) {
- if (k++ == min)
- return compare_top_ext(e1 , e2);
+ if (k++ == min){
+ if (i == j) return 0;
+ if (i < j) return -1;
+ return 1;
+ }
if ((ret = compare_top_ext(e1 , e2)) == 0)
continue;
return ret;
More information about the erlang-bugs
mailing list