[erlang-bugs] Bug in enif_compare/2 for bignums

Filipe David Manana fdmanana@REDACTED
Thu Sep 1 03:11:13 CEST 2011


Nasty bug.

I've found this apparently can only happen in 64 bits machines, where
sizeof(Sint) is smaller than sizeof(int).
The following patch fixes the issue for me:

https://github.com/fdmanana/otp/commit/a7c3edf11620cf09074da98fd0998f195cb2186e

regards,

On Wed, Aug 31, 2011 at 11:20 AM, Paul Davis
<paul.joseph.davis@REDACTED> wrote:
> Hello,
>
> I think I've uncovered a bug in enif_compare/2 for bignums. Converting
> the same arguments to ErlNifSInt64 values and using C comparison
> returns the correct result when enif_compare does not. There's a
> reduced test case at [1]. If there's nothing obvious I'll spend some
> time later digging into Erlang to see if I can spot the bug.
>
>
> Thanks,
> Paul Davis
>
> [1] https://github.com/davisp/enif_cmp_bug
> _______________________________________________
> erlang-bugs mailing list
> erlang-bugs@REDACTED
> http://erlang.org/mailman/listinfo/erlang-bugs
>



-- 
Filipe David Manana,
fdmanana@REDACTED, fdmanana@REDACTED

"Reasonable men adapt themselves to the world.
 Unreasonable men adapt the world to themselves.
 That's why all progress depends on unreasonable men."



More information about the erlang-bugs mailing list