-
Notifications
You must be signed in to change notification settings - Fork 3k
[erlc] internal consistency check failed: "illegal_branch, try_handler" #6599
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Comments
A couple of other testcases with the same error message: f(X, Y) ->
try Y of
X ->
(?MODULE:f1(
try ([_ | _] = Y) of
X ->
ok
after
ok
end
) orelse X) bsl 0
after
ok
end.
f1(_) ->
ok. and f(X) ->
{
X ++ (X = get()),
<<
(ok):(catch (0 +
try
[ok || _ <- []]
catch
_ ->
X
end))
>>
}. |
Another variant: f(X) when true; X ->
- maybe
<<>> ?= X,
f(maybe
0 ?= ([] =< ok)
end),
<<>> ?= ok
else
false ->
X;
0 ->
X
end. |
Another variant: f(X) ->
Y =
try
false = X
catch
_ ->
ok
end /= ok,
X = Y,
false = Y,
0 = ok. |
Another variant:
|
Another infinite loop in the compiler (same as #6599 (comment) above), this time without using f(_, []) ->
0;
f(X, _) ->
?MODULE:foo(
<<>> =
try f(ok, X) + 0 of
X ->
X
catch
_ ->
X
end
);
f(_, _) ->
ok. I believe that it is a duplicate of this bug because it is fixed by #6619 |
Another variant: f(X, _, X, X) ->
ok;
f(X, (X = -0.0), (X = Y), _) ->
-Y. |
Another probable variant: f(X, X) when is_integer(X) ->
ok;
f(Y, Y = #{}) ->
Y#{ok := ok}. results in
|
Thanks, I can confirm it's the same issue. :-) |
Another likely variant, but this time with f(_V0) ->
case
trunc(
try
trunc(<<>> = _V0)
catch
_ ->
0.0
end
)
of
_V0 -> ok;
_ -> 42
end. resulting in
|
Yet another likely variant, with yet another symptom: f(_V0, _V1 = _V0) when _V1; _V0 ->
_V0#{ok := ok},
try _V0 of
_V1 ->
_V1
after
ok
end#{
ok := ok
}. results in
|
I don't think so. It crashes in another compiler pass. Please put this one into a new issue. |
Here is another one from #7285:
|
Eliminating a repeated `=:=` test can result in code that beam_validator doesn't consider safe. This commit makes the optimization keep the `=:=` if it seems to be significant, that is, if one or both operands will gain type information from it. That makes it possible to compile code from erlang#6599 such as: f(X, X) when is_integer(X) -> ok; f(Y, Y = #{}) -> Y#{ok := ok}. (Seven other examples from erlang#6599 can now also be compiled.) Running `scripts/diffable` shows that this fix prevented the optimization in 14 modules (out of about 1000).
Eliminating a repeated `=:=` test can result in code that beam_validator doesn't consider safe. This commit makes the optimization keep the `=:=` if it seems to be significant, that is, if one or both operands will gain type information from it. That makes it possible to compile code from erlang#6599 such as: f(X, X) when is_integer(X) -> ok; f(Y, Y = #{}) -> Y#{ok := ok}. (Six other examples from erlang#6599 can now also be compiled.) Running `scripts/diffable` shows that this fix prevented the optimization in 14 modules (out of about 1000). Closes erlang#6599
Eliminating a repeated `=:=` test can result in code that beam_validator doesn't consider safe. This commit makes the optimization keep the `=:=` if it seems to be significant, that is, if one or both operands will gain type information from it. That makes it possible to compile code from erlang#6599 such as: f(X, X) when is_integer(X) -> ok; f(Y, Y = #{}) -> Y#{ok := ok}. (Six other examples from erlang#6599 can now also be compiled.) Running `scripts/diffable` shows that this fix prevented the optimization in 14 modules (out of about 1000). Closes erlang#6599
Eliminating a repeated `=:=` test can result in code that beam_validator doesn't consider safe. This commit makes the optimization keep the `=:=` if it seems to be significant, that is, if one or both operands will gain type information from it. That makes it possible to compile code from erlang#6599 such as: f(X, X) when is_integer(X) -> ok; f(Y, Y = #{}) -> Y#{ok := ok}. (Six other examples from erlang#6599 can now also be compiled.) Running `scripts/diffable` shows that this fix prevented the optimization in 14 modules (out of about 1000). Closes erlang#6599
Uh oh!
There was an error while loading. Please reload this page.
On master,
crashes erlc with the message:
The text was updated successfully, but these errors were encountered: