Crash when using -on_load() directive.

Rich Neswold <[email protected]>
Newsgroups gmane.comp.lang.erlang.bugs
Message-ID <CAGT4q5rg1H7Z3HyW3Cc3xxJRtGQZyyvA74UPW86NGyQauBoaEw@mail.gmail.com>
Hello,

I'm trying to use the -on_load() directive on NetBSD/amd64, but I'm having
problems. Even this simple test file (test.erl) fails:

-module(test).
-on_load(load_my_nifs/0).

load_my_nifs() ->
    io:format("Loaded module.~n"),
    ok.

Try to compile as byte-code and then native:

$ erl
Erlang/OTP 17 (erts-6.3) [source] [64-bit] [smp:8:8] [async-threads:10]
[hipe] [kernel-poll:false]

Eshell V6.3  (abort with ^G)
1> c(test).
Loaded module.
{ok,test}
2> c(test, [native]).
<HiPE (v 3.11.2)> EXITED with reason {'trans_fun/2',on_load}
@hipe_beam_to_icode:1174

=ERROR REPORT==== 18-Feb-2015::13:42:46 ===
Error in process <0.37.0> with exit value:
{{badmatch,{'EXIT',{{hipe_beam_to_icode,1174,{'trans_fun/2',on_load}},[{hipe_beam_to_icode,trans_fun,2,[]},{hipe_beam_to_icode,trans_fun,2,[]},{hipe_beam_to_icode,trans_mfa_code,5,[]},{hipe_beam_to_icode,trans_beam_function_chunk...

test.erl: internal error in native_compile;
crash
reason: {badmatch,{'EXIT',{{hipe_beam_to_icode,1174,{'trans_fun/2',on_load}},
                  [{hipe_beam_to_icode,trans_fun,2,[]},
                   {hipe_beam_to_icode,trans_fun,2,[]},
                   {hipe_beam_to_icode,trans_mfa_code,5,[]},
                   {hipe_beam_to_icode,trans_beam_function_chunk,2,[]},
                   {hipe_beam_to_icode,'-module/2-lc$^1/1-1-',2,[]},
                   {hipe,get_beam_icode,4,[]},
                   {hipe,'-run_compiler_1/3-fun-0-',4,[]},
                   {hipe_icode_callgraph,get_called_modules,1,[]}]}}}

 in function  hipe:get_beam_icode/4
 in call from hipe:'-run_compiler_1/3-fun-0-'/4
 in call from hipe_icode_callgraph:get_called_modules/1
error
3>


This also happens on an R16B03-1 installation. The documentation doesn't
mention the directive is limited to byte-code compiles. But even if it was,
the native compiler should print an error instead of crashing.

Are other platforms having this problem?

-- 
Rich

_______________________________________________
erlang-bugs mailing list
[email protected]
http://erlang.org/mailman/listinfo/erlang-bugs
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.