otp icon indicating copy to clipboard operation
otp copied to clipboard

Compiler bug: internal consistency check failed

Open josevalim opened this issue 1 year ago • 0 comments

Describe the bug

This program:

-module(foo).
-export([from/1]).

from(_order@1) ->
    {_a@1, _b@1} =
        case _order@1 of
            <<"bar">> ->
                {bar, 1};
            <<"foo">> ->
                {foo, 2};
            _s@1 ->
                case string:split("foo", "o") of
                    [] ->
                        ok;
                    _@1 ->
                        lists:flatten(
                            case _s@1 of
                                _@2 when is_binary(_@2) -> _@2;
                                _@2 -> string:split(_@2, ",")
                            end
                        )
                end,
                error
        end.

Fails to compile with:

foo:1: function from/1+58:
  Internal consistency check failed - please report this bug.
  Instruction: {call_ext,1,{extfunc,lists,flatten,1}}
  Error:       {allocated,undecided}:

Affected versions

It was originally reported on Erlang/OTP 24.2 here but I could reproduce it on 25.0.

josevalim avatar Aug 12 '22 15:08 josevalim