R19-rc1: Internal error in beam_type

Ulf Norell <[email protected]> Thu, 19 May 2016 11:00:34 +0200
Newsgroups gmane.comp.lang.erlang.bugs
Message-ID <CAJjNqYFCrc-qbP_gdUspCV-Nr30cwRF7bAmc0+cTDytgZ5doSQ@mail.gmail.com>
--===============5945529387770936353==
Content-Type: multipart/alternative; boundary=001a11443996c8920705332e36d8

--001a11443996c8920705332e36d8
Content-Type: text/plain; charset=UTF-8

On R19 rc1 (OTP-19.0-rc1 tag in git) the following module causes an
internal error when compiled:

-module(bug).

-compile(export_all).

f(pat) ->
  X = case err of
         ok  -> ok;
         err -> external:call(), 0
      end,
  case X of
    ok  -> ok;
    err -> err;
    0   -> bad
  end.

The error is:

bug.erl: internal error in beam_type;
crash reason: {case_clause,
    {'EXIT',
        {function_clause,
            [{beam_type,simplify_select_val_int,
                 [{select,select_val,
                      {x,0},
                      {f,7},
                      [{atom,ok},{f,10},{atom,err},{f,9}]},
                  0],
                 [{file,"beam_type.erl"},{line,169}]},
             {beam_type,simplify_basic_1,3,
                 [{file,"beam_type.erl"},{line,155}]},
             {beam_type,opt,3,[{file,"beam_type.erl"},{line,57}]},
             {beam_type,function,1,[{file,"beam_type.erl"},{line,36}]},
             {beam_type,'-module/2-lc$^0/1-0-',1,
                 [{file,"beam_type.erl"},{line,30}]},
             {beam_type,module,2,[{file,"beam_type.erl"},{line,30}]},
             {compile,'-select_passes/2-anonymous-2-',2,
                 [{file,"compile.erl"},{line,521}]},
             {compile,'-internal_comp/4-anonymous-1-',2,
                 [{file,"compile.erl"},{line,306}]}]}}}

  in function  compile:'-select_passes/2-anonymous-2-'/2 (compile.erl, line
521)
  in call from compile:'-internal_comp/4-anonymous-1-'/2 (compile.erl, line
306)
  in call from compile:fold_comp/3 (compile.erl, line 332)
  in call from compile:internal_comp/4 (compile.erl, line 316)
  in call from compile:'-do_compile/2-anonymous-0-'/2 (compile.erl, line
166)

/ Ulf

--001a11443996c8920705332e36d8
Content-Type: text/html; charset=UTF-8
Content-Transfer-Encoding: quoted-printable

<div dir=3D"ltr"><div>On R19 rc1 (OTP-19.0-rc1 tag in git) the following mo=
dule 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) -&gt;</div><div>=C2=A0 X =3D case err=
 of</div><div>=C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0ok =C2=A0-&gt; ok;</div><di=
v>=C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0err -&gt; external:call(), 0</div><div>=
=C2=A0 =C2=A0 =C2=A0 end,</div><div>=C2=A0 case X of</div><div>=C2=A0 =C2=
=A0 ok =C2=A0-&gt; ok;</div><div>=C2=A0 =C2=A0 err -&gt; err;</div><div>=C2=
=A0 =C2=A0 0 =C2=A0 -&gt; bad</div><div>=C2=A0 end.</div><div><br></div><di=
v>The error is:</div><div><br></div><div><div>bug.erl: internal error in be=
am_type;</div><div>crash reason: {case_clause,</div><div>=C2=A0 =C2=A0 {&#3=
9;EXIT&#39;,</div><div>=C2=A0 =C2=A0 =C2=A0 =C2=A0 {function_clause,</div><=
div>=C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 [{beam_type,simplify_select_v=
al_int,</div><div>=C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =
=C2=A0[{select,select_val,</div><div>=C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=
=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 {x,0},</div><div>=C2=A0 =C2=A0 =C2=
=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 {f,7},</div><di=
v>=C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=
=A0 [{atom,ok},{f,10},{atom,err},{f,9}]},</div><div>=C2=A0 =C2=A0 =C2=A0 =
=C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 0],</div><div>=C2=A0 =C2=A0 =C2=
=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0[{file,&quot;beam_type.erl&quo=
t;},{line,169}]},</div><div>=C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=
=A0{beam_type,simplify_basic_1,3,</div><div>=C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=
=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0[{file,&quot;beam_type.erl&quot;},{line,155}=
]},</div><div>=C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0{beam_type,op=
t,3,[{file,&quot;beam_type.erl&quot;},{line,57}]},</div><div>=C2=A0 =C2=A0 =
=C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0{beam_type,function,1,[{file,&quot;beam_t=
ype.erl&quot;},{line,36}]},</div><div>=C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =
=C2=A0 =C2=A0{beam_type,&#39;-module/2-lc$^0/1-0-&#39;,1,</div><div>=C2=A0 =
=C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0[{file,&quot;beam_ty=
pe.erl&quot;},{line,30}]},</div><div>=C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=
=A0 =C2=A0{beam_type,module,2,[{file,&quot;beam_type.erl&quot;},{line,30}]}=
,</div><div>=C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0{compile,&#39;-=
select_passes/2-anonymous-2-&#39;,2,</div><div>=C2=A0 =C2=A0 =C2=A0 =C2=A0 =
=C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0[{file,&quot;compile.erl&quot;},{line,521=
}]},</div><div>=C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0{compile,&#3=
9;-internal_comp/4-anonymous-1-&#39;,2,</div><div>=C2=A0 =C2=A0 =C2=A0 =C2=
=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0[{file,&quot;compile.erl&quot;},{line=
,306}]}]}}}</div><div><br></div><div>=C2=A0 in function =C2=A0compile:&#39;=
-select_passes/2-anonymous-2-&#39;/2 (compile.erl, line 521)</div><div>=C2=
=A0 in call from compile:&#39;-internal_comp/4-anonymous-1-&#39;/2 (compile=
.erl, line 306)</div><div>=C2=A0 in call from compile:fold_comp/3 (compile.=
erl, line 332)</div><div>=C2=A0 in call from compile:internal_comp/4 (compi=
le.erl, line 316)</div><div>=C2=A0 in call from compile:&#39;-do_compile/2-=
anonymous-0-&#39;/2 (compile.erl, line 166)</div></div><div><br></div><div>=
/ Ulf</div></div>

--001a11443996c8920705332e36d8--

--===============5945529387770936353==
Content-Type: text/plain; charset="us-ascii"
MIME-Version: 1.0
Content-Transfer-Encoding: 7bit
Content-Disposition: inline

_______________________________________________
erlang-bugs mailing list
[email protected]
http://erlang.org/mailman/listinfo/erlang-bugs

--===============5945529387770936353==--