erlang/otp

erlc crash in pass beam_ssa_bool

RobinMorisset opened this issue · 1 comments

On the following code:

-module(ssa_bool).
-compile([export_all]).

f(V1) ->
    case 0 of
        V2 ->
            (case is_list(V1) of
                V3 ->
                    (case
                        (((is_float(
                            V2
                        )) or V3) orelse
                            V2)
                    of
                        V4 when
                            V3
                        ->
                            0
                    end) =< V3
            end)
    end.

erlc crashes with the following error message:

Function: f/1
minimized/ssa_bool.erl: internal error in pass beam_ssa_bool:
exception error: no case clause matching {fail,8}
in function beam_ssa_bool:redirect_test_1/3 (beam_ssa_bool.erl, line 1071)
in call from beam_ssa_bool:redirect_test/4 (beam_ssa_bool.erl, line 1061)
in call from beam_ssa_bool:bool_opt_rewrite/5 (beam_ssa_bool.erl, line 630)
in call from beam_ssa_bool:bool_opt/3 (beam_ssa_bool.erl, line 579)
in call from beam_ssa_bool:bool_opt/3 (beam_ssa_bool.erl, line 572)
in call from beam_ssa_bool:opt_function/1 (beam_ssa_bool.erl, line 157)
in call from beam_ssa_bool:function/1 (beam_ssa_bool.erl, line 140)
in call from beam_ssa_bool:'-module/2-lc$^0/1-0-'/1 (beam_ssa_bool.erl, line 135)

I've been unable to minimize the testcase any further, every part of it seems required somehow for this bug to trigger.

The linked pull request fixes the problem. I will be included in OTP 25.1.