[erlang-bugs] Crash when using -on_load() directive.

Rich Neswold rich.neswold@REDACTED
Wed Feb 18 21:55:53 CET 2015


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
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://erlang.org/pipermail/erlang-bugs/attachments/20150218/534349fa/attachment.htm>


More information about the erlang-bugs mailing list