[erlang-bugs] Compiler crash

Bjorn Gustavsson bjorn@REDACTED
Thu Mar 27 07:53:56 CET 2008


"Vladimir Klebansky" <VKlebansky@REDACTED> writes:

> Compiler crashes when compiling this small sample program (tst.erl):
[...]

Thanks for the bug report. The following patch corrects the problem:

*** lib/compiler/src/sys_core_fold.erl@@/OTP_R12B-1	Tue Feb  5 14:37:37 2008
--- lib/compiler/src/sys_core_fold.erl	Wed Mar 26 11:25:54 2008
***************
*** 1995,2005 ****
      Tdb = update_types_1(Expr, Pat, Tdb0),
      Sub#sub{t=Tdb}.
  
! update_types_1(#c_var{name=V}, [#c_tuple{}=P], Types) ->
!     orddict:store(V, P, Types);
  update_types_1(_, _, Types) -> Types.
  
! %% update_types(V, Tdb) -> Tdb'
  %%  Kill any entries that references the variable,
  %%  either in the key or in the value.
  kill_types(V, [{V,_}|Tdb]) ->
--- 1995,2015 ----
      Tdb = update_types_1(Expr, Pat, Tdb0),
      Sub#sub{t=Tdb}.
  
! update_types_1(#c_var{name=V,anno=Anno}, Pat, Types) ->
!     case member(reuse_for_context, Anno) of
! 	true ->
! 	    %% If a variable has been marked for reuse of binary context,
! 	    %% optimizations based on type information are unsafe.
! 	    kill_types(V, Types);
! 	false ->
! 	    case Pat of
! 		[#c_tuple{}=P] -> orddict:store(V, P, Types);
! 		_ -> Types
! 	    end
!     end;
  update_types_1(_, _, Types) -> Types.
  
! %% kill_types(V, Tdb) -> Tdb'
  %%  Kill any entries that references the variable,
  %%  either in the key or in the value.
  kill_types(V, [{V,_}|Tdb]) ->

-- 
Björn Gustavsson, Erlang/OTP, Ericsson AB



More information about the erlang-bugs mailing list