elixir-lang / elixir

Elixir is a dynamic, functional language for building scalable and maintainable applications
https://elixir-lang.org/
Apache License 2.0
24.28k stars 3.34k forks source link

Error compiling Elixir on upcoming Erlang/OTP 22 #8287

Closed voteleobrown closed 5 years ago

voteleobrown commented 5 years ago

Environment

Elixir & Erlang/OTP versions (elixir --version):

Erlang/OTP 22 [DEVELOPMENT] [erts-10.1.1] [source-c61ce5d] [64-bit] [smp:2:2] [ds:2:2:10] [async-threads:1] [hipe]

Operating system:

cat /etc/os-release

NAME="Sangoma Linux"
VERSION="7 (Core)"
ID="sangoma"
ID_LIKE="centos rhel fedora"
VERSION_ID="7"
PRETTY_NAME="Sangoma Linux 7 (Core)"
ANSI_COLOR="0;31"
CPE_NAME="cpe:/o:sangoma:sng:7::server:utf8"
HOME_URL="https://distro.sangoma.net/"
BUG_REPORT_URL="https://issues.sangoma.net/"

CENTOS_MANTISBT_PROJECT="Sangoma-7"
CENTOS_MANTISBT_PROJECT_VERSION="7"
REDHAT_SUPPORT_PRODUCT="sangoma"
REDHAT_SUPPORT_PRODUCT_VERSION="7"

Current behavior

git clone https://github.com/elixir-lang/elixir.git
cd elixir
make clean test

Resulting Error Message

==> bootstrap (compile)
Compiled lib/elixir/lib/kernel.ex
Compiled lib/elixir/lib/macro/env.ex
Compiled lib/elixir/lib/keyword.ex
Compiled lib/elixir/lib/module.ex
Compiled lib/elixir/lib/list.ex
Compiled lib/elixir/lib/macro.ex
Compiled lib/elixir/lib/code.ex
Compiled lib/elixir/lib/code/identifier.ex
Compiled lib/elixir/lib/module/locals_tracker.ex
Compiled lib/elixir/lib/module/locals_tracker.ex
Compiled lib/elixir/lib/kernel/typespec.ex
Compiled lib/elixir/lib/kernel/utils.ex
Compiled lib/elixir/lib/exception.ex
Compiled lib/elixir/lib/protocol.ex
Compiled lib/elixir/lib/stream/reducers.ex
Compiled lib/elixir/lib/enum.ex
error: #{'__exception__' => true,'__struct__' => 'Elixir.CompileError',
         description =>
             <<"function container_each/6+111:\n  Internal consistency check failed - please report this bug.\n  Instruction: {move,{y,3},{x,2}}\n  Error:       {unassigned,{y,3}}:\n">>,
         file => <<"Elixir.Inspect.Algebra">>,line => 0}
stacktrace: [{lists,foreach,2,[{file,"lists.erl"},{line,1338}]},
             {elixir_erl,load_form,5,[{file,"src/elixir_erl.erl"},{line,437}]},
             {elixir_erl_compiler,'-spawn/2-fun-0-',3,
                                  [{file,"src/elixir_erl_compiler.erl"},
                                   {line,12}]},
             {elixir,eval_forms,4,[{file,"src/elixir.erl"},{line,258}]},
             {elixir_compiler,eval_forms,3,
                             [{file,"src/elixir_compiler.erl"},{line,49}]},
             {elixir_compiler,quoted,2,
                             [{file,"src/elixir_compiler.erl"},{line,23}]},
             {elixir_compiler,bootstrap_file,1,
                              [{file,"src/elixir_compiler.erl"},{line,130}]},
             {elixir_compiler,'-bootstrap/0-lc$^1/1-0-',1,
                              [{file,"src/elixir_compiler.erl"},{line,126}]}]
make: *** [lib/elixir/ebin/Elixir.Kernel.beam] Error 1

Expected behavior

Successful compile.

josevalim commented 5 years ago

Hi @voteleobrown! Note we don't support Erlang/OTP 22 as it is still in development. This is most likely an Erlang/OTP 22 bug, which should be isolated and reported upstream. Thanks!

josevalim commented 5 years ago

Btw, we would love if someone could look into this and try to isolate it. My suggestion is to using something like asdf, kerl, kiex to get latest Erlang and then run make clean_elixir compile multiple times. You can see the Inspect.Algebra module is failing, so I would try to make it smaller and smaller, removing docs, code, etc, until we have a minimum case.

michalmuskala commented 5 years ago

The minimal erlang example I was able to come up with is:

-module('Elixir.Test').

-export([container_each/6]).

container_each([_left@1|_right@1],
               _limit@1,
               _opts@1,
               _fun@1,
               _acc@1,
               _simple@1) ->
    _limit@2 = id(_limit@1),
    _left@2 = _fun@1(_left@1, _opts@1#{limit := _limit@2}),
    _right@2 = _fun@1(_right@1, _opts@1#{limit := _limit@2}),
    _simple@2 =
        case
            case _simple@1 of
                false ->
                    false;
                true ->
                    id(_left@2);
                __@1 ->
                    error({badbool,'and',__@1})
            end
        of
            false ->
                false;
            true ->
                id(_right@2);
            __@2 ->
                error({badbool,'and',__@2})
        end,
    _doc@1 = join(_left@2, _right@2, _simple@2, <<"...">>),
    {lists:reverse([_doc@1|_acc@1]),_simple@2}.

id(_x@1) ->
    _x@1.

join(_x@1, _, _, _) ->
    _x@1.

I've reported it today morning.

josevalim commented 5 years ago

Beautiful. :heart: :green_heart: :blue_heart: :yellow_heart: :purple_heart: