[erlang-bugs] Segmentation fault when running HIPE-compilled code

Mikael Pettersson <>
Thu Jan 15 09:53:57 CET 2009


Sergey S writes:
 > 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.

Please give us some information about your system:
1. Which CPU type? Is it 32- or 64-bit?
2. Which C compiler and version?
3. Which OS / distribution / version?



More information about the erlang-bugs mailing list