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

internal error in beam_ssa_opt

    XMLWordPrintable

    Details

    • Type: Bug
    • Status: Resolved
    • Priority: Major
    • Resolution: Fixed
    • Affects Version/s: None
    • Fix Version/s: 23.0
    • Component/s: compiler
    • Labels:
      None

      Description

      The following code does not compile with Erlang `master` branch (built from commit 988264c05731329d967a21e81f70e172c647751f):

      -module(rabbit_log_tail).
      
      -export([reverse_read_n_lines/1]).
      
      reverse_read_n_lines(N) ->
          GuessPosition = offset(),
          case {1 >= N, GuessPosition == 0} of
              {true, _} -> ok;
              {_, true} -> ok;
              _         -> reverse_read_n_lines(N)
          end.
      
      offset() ->
          200.
      

      It compiles just fine with Erlang 21.3.8.7 and 22.1.

      This is a reduced code sample from the initial file I have, so it is not meant to be correct at runtime.

      Here is the error:

      Sub pass ssa_opt_type_start
      Function: reverse_read_n_lines/1
      rabbit_log_tail.erl: internal error in beam_ssa_opt;
      crash reason: {case_clause,{'EXIT',{{badkey,{b_var,2}},
                            [{erlang,map_get,
                                     [{b_var,2},
                                      #{{b_var,0} => any,
                                        {b_var,'GuessPosition'} =>
                                            {t_integer,{200,200}}}],
                                     []},
                             {beam_ssa_type,simplify_arg,3,
                                            [{file,"beam_ssa_type.erl"},
                                             {line,1195}]},
                             {beam_ssa_type,'-simplify_args/3-lc$^0/1-0-',3,
                                            [{file,"beam_ssa_type.erl"},{line,657}]},
                             {beam_ssa_type,opt_is,7,
                                            [{file,"beam_ssa_type.erl"},{line,254}]},
                             {beam_ssa_type,opt_1,6,
                                            [{file,"beam_ssa_type.erl"},{line,174}]},
                             {beam_ssa_type,opt_continue_1,5,
                                            [{file,"beam_ssa_type.erl"},{line,115}]},
                             {beam_ssa_opt,ssa_opt_type_start,1,
                                           [{file,"beam_ssa_opt.erl"},{line,303}]},
                             {compile,run_sub_passes_1,3,
                                      [{file,"compile.erl"},{line,446}]}]}}}
      
        in function  compile:'-select_passes/2-anonymous-2-'/3 (compile.erl, line 679)
        in call from compile:'-internal_comp/5-anonymous-1-'/3 (compile.erl, line 403)
        in call from compile:fold_comp/4 (compile.erl, line 430)
        in call from compile:internal_comp/5 (compile.erl, line 414)
        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:
            bjorn Björn Gustavsson
            Reporter:
            dumbbell dumbbell
            Votes:
            0 Vote for this issue
            Watchers:
            2 Start watching this issue

              Dates

              Created:
              Updated:
              Resolved: