[erlc] internal error in beam_kernel_to_ssa:collect_preds
RobinMorisset opened this issue · 1 comments
RobinMorisset commented
On master,
f(X, 0) ->
try
0 = {
_ = 0 + 0,
Z = bnot ok,
{(_ = ok), (_ = X)}#{ok => ok},
ok +
(f1(
ok +
f1(
ok +
(f1(
(Y =
-f1(
#{
(ok +
(ok +
f1(
case
try ok of
_ ->
fun(_) ->
ok
end
after
ok
end
of
#{} ->
ok
end
))) => ok
} > ok
))
) + ok)
) >
ok
))
}
of
_ ->
Z;
_ ->
Y
after
ok
end.
f1(_) ->
ok.
crashes erlc with the following error message:
Function: f/2
minimized/final_collect_preds.erl: internal error in pass beam_kernel_to_ssa:
exception error: no function clause matching beam_kernel_to_ssa:collect_preds([[]],[{{b_literal,unused},55}],[[]])
in function beam_kernel_to_ssa:gen_phis/2 (beam_kernel_to_ssa.erl, line 1271)
in call from beam_kernel_to_ssa:gen_phis/2 (beam_kernel_to_ssa.erl, line 1273)
in call from beam_kernel_to_ssa:fix_phis_1/3 (beam_kernel_to_ssa.erl, line 1239)
in call from beam_kernel_to_ssa:fix_phis_1/3 (beam_kernel_to_ssa.erl, line 1263)
in call from beam_kernel_to_ssa:fix_phis_1/3 (beam_kernel_to_ssa.erl, line 1251)
in call from beam_kernel_to_ssa:fix_phis_1/3 (beam_kernel_to_ssa.erl, line 1265)
in call from beam_kernel_to_ssa:fix_phis_1/3 (beam_kernel_to_ssa.erl, line 1251)
I've already minimized the testcase as much as I could; the three expressions in
_ = 0 + 0,
Z = bnot ok,
{(_ = ok), (_ = X)}#{ok => ok},
can be moved rather freely within the function and the bug keeps reproducing, but removing or simplifying any of them makes it disappear.
RobinMorisset commented
This testcase reminds me of the one in #6572 (comment), which was similarly big because it needed to hit the fixpoint iteration limit.