enif_make_int64 => -0 for INT64_MIN with gcc 4.9.1

Tomas Abrahamsson <[email protected]>
Newsgroups gmane.comp.lang.erlang.bugs
Message-ID <CAEP-UQ2Oe5W_=8QXtXAaTtCCGgu0hkGM3mA14Gpa88rUnRL+kQ@mail.gmail.com>
Hi,

I upgraded gcc from version 4.8.1 to 4.9.1, recompiled Erlang/OTP-17.1.1
and my nif, and now enif_make_int64 creates -0 for INT64_MIN.

  % make test
  erl -s int64nif go -s erlang halt
  Erlang/OTP 17 [erts-6.1.1] [source] [smp:4:4] [async-threads:10]
[kernel-poll:false]

  -0

When Erlang was compiled with gcc-4.8.1, it printed -9223372036854775808,
I've attached the test programs, here are the important lines:

    go() ->
        io:format("~p~n", [int64_from_nif()]).

The NIF C-code contains:

    static ERL_NIF_TERM
    int64_from_nif(ErlNifEnv *env, int argc, const ERL_NIF_TERM argv[])
    {
        return enif_make_int64(env, INT64_MIN);
    }

System information:

  OS: linux, 32-bit core i5, 3.14-1-686-pae (debian unstable)
  Erlang/OTP: built from scratch (both times) from the OTP-17.1.1 git tag.
  gcc: initially: gcc (Debian 4.8.1-10) 4.8.1
       with this one, it prints -9223372036854775808
  gcc: after upgrade: gcc (Debian 4.9.1-1) 4.9.1
       with this one, it prints -0

The only change I did was apt-get install gcc and then rebuilding Erlang.

BRs
Tomas

_______________________________________________
erlang-bugs mailing list
[email protected]
http://erlang.org/mailman/listinfo/erlang-bugs
int64nif.tar.gz (application/x-gzip, 851 B) - not displayed
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.