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

Compiler crash on try-catch statement

    XMLWordPrintable

    Details

    • Type: Bug
    • Status: Resolved
    • Priority: Minor
    • Resolution: Fixed
    • Affects Version/s: OTP-22.0, OTP-22.1, OTP-22.2
    • Fix Version/s: 22.2.7
    • Component/s: compiler
    • Labels:
      None

      Description

      -module(test).
      -export([foo/0]).
      foo() ->
        try bar() of 
          _ -> fun() -> ok end 
        catch _ -> ok end,
        ok.
      
      bar() -> ok.

      The small module above, when given to the compiler in OTP-22 (not tested on all point releases, but 22.0, 22.1 and 22.2.6) will result in a compiler crash:

      ~/Scratch/otp_weird: erlc test.erl
      Function: foo/0
      test.erl: internal error in beam_kernel_to_ssa;
      crash reason: {case_clause,
          {'EXIT',
              {{badmatch,[]},
               [{beam_kernel_to_ssa,internal_cg,5,
                    [{file,"beam_kernel_to_ssa.erl"},{line,705}]},
                {beam_kernel_to_ssa,cg,2,
                    [{file,"beam_kernel_to_ssa.erl"},{line,111}]},
                {beam_kernel_to_ssa,try_cg,7,
                    [{file,"beam_kernel_to_ssa.erl"},{line,835}]},
                {beam_kernel_to_ssa,cg,2,
                    [{file,"beam_kernel_to_ssa.erl"},{line,111}]},
                {beam_kernel_to_ssa,do_match_cg,3,
                    [{file,"beam_kernel_to_ssa.erl"},{line,150}]},
                {beam_kernel_to_ssa,cg_fun,2,
                    [{file,"beam_kernel_to_ssa.erl"},{line,87}]},
                {beam_kernel_to_ssa,function,2,
                    [{file,"beam_kernel_to_ssa.erl"},{line,72}]},
                {beam_kernel_to_ssa,'-functions/2-lc$^0/1-0-',2,
                    [{file,"beam_kernel_to_ssa.erl"},{line,62}]}]}}}  in function  compile:'-select_passes/2-anonymous-2-'/3 (compile.erl, line 675)
        in call from compile:'-internal_comp/5-anonymous-1-'/3 (compile.erl, line 399)
        in call from compile:fold_comp/4 (compile.erl, line 426)
        in call from compile:internal_comp/5 (compile.erl, line 410)
        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)
      

      It works well on OTP-21.

       

        Attachments

          Activity

            People

            Assignee:
            bjorn Björn Gustavsson
            Reporter:
            hanssv hanssv
            Votes:
            0 Vote for this issue
            Watchers:
            2 Start watching this issue

              Dates

              Created:
              Updated:
              Resolved: