[erlang-bugs] Segmentation fault when running HIPE-compilled code
Sergey S
ad.sergey@REDACTED
Wed Jan 14 22:38:39 CET 2009
Hello.
While I was playing with +native option, I run into a bug in HIPE
which leads to segmentation fault.
To reproduce the bug just compile the code below using HIPE and run
crash:start/0. Your will see the following:
Erlang (BEAM) emulator version 5.6.5 [source] [smp:2]
[async-threads:0] [hipe] [kernel-poll:false]
Eshell V5.6.5 (abort with ^G)
1> crash:start().
# This message will be printed only once when compiled with +native
Segmentation fault
Here is the code (don't look for intention of this example, it has not
got that):
%---------------------------------------------------
-module(crash).
-export([start/0]).
start() ->
spawn(fun() -> init() end).
init() ->
repeat(10, fun() -> void end),
receive after infinity -> ok end.
repeat(0, _) ->
ok;
repeat(N, Fun) ->
io:format("# This message will be printed only once when compiled
with +native~n"),
Fun(),
repeat(N - 1, Fun). % <------ It never will be called if you use HIPE
%---------------------------------------------------
The same code compiled without +native flag works well to me. I'm
using Erlang R12B5.
When I saw that segfault, I tried to replace "receive" statement with
"timer:sleep(999999)" call, and it helped!
--
Sergey
More information about the erlang-bugs
mailing list