erlang/otp

[erlc] internal error in pass beam_ssa_opt

RobinMorisset opened this issue · 0 comments

Describe the bug
Running erlc on the following code:

f() ->
    [
        0
     || is_function([0 || <<_>> <= <<>>], -9223372036854775808),
        <<>> <= ok
    ].

results in the following error message:

Sub pass ssa_opt_type_continue
Function: '-f/0-lc$^1/1-1-'/1
/home/rmorisset/minimized/test12716.erl: internal error in pass beam_ssa_opt:
exception error: no function clause matching beam_types:join([]) 
  in function  beam_ssa_type:join_arg_types/3 (beam_ssa_type.erl, line 449)
  in call from beam_ssa_type:opt_continue/4 (beam_ssa_type.erl, line 432)
  in call from beam_ssa_opt:ssa_opt_type_continue/1 (beam_ssa_opt.erl, line 449)
  in call from compile:run_sub_passes_1/3 (compile.erl, line 424)
  in call from beam_ssa_opt:phase/4 (beam_ssa_opt.erl, line 116)
  in call from beam_ssa_opt:fixpoint/6 (beam_ssa_opt.erl, line 99)
  in call from beam_ssa_opt:run_phases/3 (beam_ssa_opt.erl, line 85)

Affected versions

Additional context
The same error also happens on the following test cases:

f() ->
    case -9223372036854775808 of
        _V0 ->
            [
                0
             || is_function(
                    [
                        0
                     || catch case [] of
                            _ when ok ->
                                ok
                        end,
                        _ <- "dp77cbgaiMEwxlY"
                    ],
                    _V0
                ),
                _ <- ok
            ]
    end.

and

f(_V1) ->
    <<
        0
     || is_function(
            case iolist_size(binary_to_list(ok)) of
                1 ->
                    (_V1 andalso #{ ok => ok || _ := _ <- ok})#{ok := ok};
                _ ->
                    ok
            end,
            _V1
        ),
        _ <- ok
    >>.