Uploaded image for project: 'Erlang/OTP'
  1. Erlang/OTP
  2. ERL-1072

Internal error in beam_ssa_pre_codegen

    XMLWordPrintable

    Details

    • Type: Bug
    • Status: Resolved
    • Priority: Major
    • Resolution: Fixed
    • Affects Version/s: 22.0.4
    • Fix Version/s: OTP-22.1
    • Component/s: compiler
    • Labels:
      None

      Description

      The following code when compiled with OTP 22.0.4 fails with "internal error in beam_ssa_pre_codegen"

      -module(test).
      
      -export([test/2]).
      
      -import(lists, [member/2]).
      
      test(X, Options) ->
          Passes = [{pre_y, fun foo/2}] ++ [{z, fun foo/2} || member(is_z, Options)] ++ [{post_y, fun foo/2}],
          foo(Passes, X).
      
      foo(_, _) -> ok.
      

      Full error:

      Sub pass linear_scan
      Function: '-test/2-fun-0-'/2
      test.erl: internal error in beam_ssa_pre_codegen;
      crash reason: {case_clause,
          {'EXIT',
              {{badkey,{b_var,11}},
               [{erlang,map_get,
                    [{b_var,11},
                     #{{b_var,'V1'} => {x,0},
                       {b_var,'V2'} => {x,1},
                       {b_var,{'@ssa_ret',3}} => x}],
                    []},
                {beam_ssa_pre_codegen,init_interval,2,
                    [{file,"beam_ssa_pre_codegen.erl"},{line,2637}]},
                {beam_ssa_pre_codegen,linear_scan,1,
                    [{file,"beam_ssa_pre_codegen.erl"},{line,2621}]},
                {compile,run_sub_passes_1,3,[{file,"compile.erl"},{line,439}]},
                {beam_ssa_pre_codegen,function,3,
                    [{file,"beam_ssa_pre_codegen.erl"},{line,168}]},
                {beam_ssa_pre_codegen,functions,3,
                    [{file,"beam_ssa_pre_codegen.erl"},{line,87}]},
                {beam_ssa_pre_codegen,functions,3,
                    [{file,"beam_ssa_pre_codegen.erl"},{line,87}]},
                {beam_ssa_pre_codegen,module,2,
                    [{file,"beam_ssa_pre_codegen.erl"},{line,83}]}]}}}
      
        in function  compile:'-select_passes/2-anonymous-2-'/3 (compile.erl, line 672)
        in call from compile:'-internal_comp/5-anonymous-1-'/3 (compile.erl, line 396)
        in call from compile:fold_comp/4 (compile.erl, line 423)
        in call from compile:internal_comp/5 (compile.erl, line 407)
        in call from compile:'-do_compile/2-anonymous-0-'/2 (compile.erl, line 207)
        in call from compile:'-do_compile/2-anonymous-1-'/1 (compile.erl, line 223)
      

        Attachments

          Activity

            People

            Assignee:
            john John Högberg
            Reporter:
            michalmuskala Michał Muskała
            Votes:
            0 Vote for this issue
            Watchers:
            2 Start watching this issue

              Dates

              Created:
              Updated:
              Resolved: