Compiler reports `Internal consistency check failed`
While trying to reduce the problem I got different errors:
-module(err_put_list). -export([loop/7]). loop(Self, Fun, List, Act, ToReceive, Timeout, Results) -> {Result, RemList} = receive {_Pos, _R} = Res when List =/= [] -> [H|T] = List, spawn_link(fun() -> Self ! {Act, Fun(H)} end), {Res, T}; {_Pos, _R} = Res when List =:= [] -> {Res, []} end, loop(Self, Fun, RemList, Act, ToReceive-1, Timeout, [Result | Results]).
erlc err_put_list.erl err_put_list: function loop/7+39: Internal consistency check failed - please report this bug. Instruction: {put_list,{y,8},{y,1},{x,6}} Error: {unassigned,{y,8}}:
-module(err_gc_bif). -export([loop/3]). loop(List, ToReceive, Results) -> {Result, RemList} = receive {_Pos, _R} = Res when List =/= [] -> [_H|T] = List, {Res, T}; {_Pos, _R} = Res when List =:= [] -> {Res, []} end, loop(RemList, ToReceive-1, [Result | Results]).
erlc err_gc_bif.erl err_gc_bif: function loop/3+23: Internal consistency check failed - please report this bug. Instruction: {gc_bif,'-',{f,0},4,[{y,1},{integer,1}],{x,1}} Error: {{x,3},not_live}:
-module(err_test_heap). -export([loop/2]). loop(List, Results) -> {Result, RemList} = receive {_Pos, _R} = Res when List =/= [] -> [_H|T] = List, {Res, T}; {_Pos, _R} = Res when List =:= [] -> {Res, []} end, loop(RemList, [Result | Results]).
erlc err_test_heap.erl err_test_heap: function loop/2+21: Internal consistency check failed - please report this bug. Instruction: {test_heap,2,3} Error: {{x,2},not_live}:
This on macOS Mojave 10.14.4 compiled with kerl.
Cannot reproduce on older Erlang (21.3.8.1).
As I got different errors while reducing the example, I stopped after the 3rd one.
Erlang/OTP 22 [erts-10.4] [source] [64-bit] [smp:4:4] [ds:4:4:10] [async-threads:1] Eshell V10.4 (abort with ^G) 1> proplists:get_value(cflags,erlang:system_info(compile_info)). "-Werror=undef -Werror=implicit -Werror=return-type -g -O2 -I/Users/aboroska/.kerl/builds/r22.0.1/otp_src_git/erts/x86_64-apple-darwin18.5.0 -DHAVE_CONFIG_H -Wall -Wstrict-prototypes -Wmissing-prototypes -Wdeclaration-after-statement -DUSE_THREADS -D_THREAD_SAFE -D_REENTRANT -DPOSIX_THREADS "