[erlang-bugs] sys_core_fold forgets about aliases when marking bit string variables for context reusing

Anthony Ramine <>
Sat Nov 16 13:27:23 CET 2013


Hello,

I have trying to fix a bug for a while without success so I post it here.

t(Bin1) ->
    case Bin1 of
        <<>> -> ok;
        Bin2 ->
            case Bin1 of
                <<0>> -> ok;
                _ -> Bin2
            end
    end.

In the following function, sys_core_fold fails to see that Bin2 is an alias of Bin1 and does not emit a bs_context_to_binary, making beam_validator crash quite violently:

t: function t/1+17:
  Internal consistency check failed - please report this bug.
  Instruction: return
  Error:       {match_context,{x,0}}:

Regards,

-- 
Anthony Ramine



More information about the erlang-bugs mailing list