[erlang-questions] Binary matching problem

Bjorn Gustavsson <>
Tue Feb 26 16:17:24 CET 2008


Kostis Sagonas <> writes:

> Tomas Stejskal wrote:
> > It doesn't really work for me. I have erlang R12B-1 and it seems you've 
> > tried it out on version R11B5, maybe it's a bug in R12.

.
.
.

> Bjorn, now do your magic ;-)

Thanks for the bug report!

I have extended the compiler test suite and corrected the bug. The following
patch solves the problem:

*** lib/compiler/src/beam_dead.erl@@/OTP_R12B   Mon Nov 26 19:59:24 2007
--- lib/compiler/src/beam_dead.erl      Tue Feb 26 16:08:04 2008
***************
*** 512,518 ****
      end;
  count_bits_matched([{test,_,_,_}|Is], SavePoint, Bits) ->
      count_bits_matched(Is, SavePoint, Bits);
! count_bits_matched([{bs_save2,_,SavePoint}|_], SavePoint, Bits) ->
      %% The save point we are looking for - we are done.
      Bits;
  count_bits_matched([{bs_save2,_,_}|Is], SavePoint, Bits) ->
--- 512,518 ----
      end;
  count_bits_matched([{test,_,_,_}|Is], SavePoint, Bits) ->
      count_bits_matched(Is, SavePoint, Bits);
! count_bits_matched([{bs_save2,Reg,SavePoint}|_], {Reg,SavePoint}, Bits) ->
      %% The save point we are looking for - we are done.
      Bits;
  count_bits_matched([{bs_save2,_,_}|Is], SavePoint, Bits) ->

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



More information about the erlang-questions mailing list