<div dir="ltr"><div>On R19 rc1 (OTP-19.0-rc1 tag in git) the following module causes an internal error when compiled:</div>
<div><br></div><div>-module(bug).</div><div><br></div><div>-compile(export_all).</div><div><br></div><div>f(pat) -></div><div> X = case err of</div><div> ok -> ok;</div><div> err -> external:call(), 0</div><div> end,</div><div> case X of</div><div> ok -> ok;</div><div> err -> err;</div><div> 0 -> bad</div><div> end.</div><div><br></div><div>The error is:</div><div><br></div><div><div>bug.erl: internal error in beam_type;</div><div>crash reason: {case_clause,</div><div> {'EXIT',</div><div> {function_clause,</div><div> [{beam_type,simplify_select_val_int,</div><div> [{select,select_val,</div><div> {x,0},</div><div> {f,7},</div><div> [{atom,ok},{f,10},{atom,err},{f,9}]},</div><div> 0],</div><div> [{file,"beam_type.erl"},{line,169}]},</div><div> {beam_type,simplify_basic_1,3,</div><div> [{file,"beam_type.erl"},{line,155}]},</div><div> {beam_type,opt,3,[{file,"beam_type.erl"},{line,57}]},</div><div> {beam_type,function,1,[{file,"beam_type.erl"},{line,36}]},</div><div> {beam_type,'-module/2-lc$^0/1-0-',1,</div><div> [{file,"beam_type.erl"},{line,30}]},</div><div> {beam_type,module,2,[{file,"beam_type.erl"},{line,30}]},</div><div> {compile,'-select_passes/2-anonymous-2-',2,</div><div> [{file,"compile.erl"},{line,521}]},</div><div> {compile,'-internal_comp/4-anonymous-1-',2,</div><div> [{file,"compile.erl"},{line,306}]}]}}}</div><div><br></div><div> in function compile:'-select_passes/2-anonymous-2-'/2 (compile.erl, line 521)</div><div> in call from compile:'-internal_comp/4-anonymous-1-'/2 (compile.erl, line 306)</div><div> in call from compile:fold_comp/3 (compile.erl, line 332)</div><div> in call from compile:internal_comp/4 (compile.erl, line 316)</div><div> in call from compile:'-do_compile/2-anonymous-0-'/2 (compile.erl, line 166)</div></div><div><br></div><div>/ Ulf</div></div>