[erlang-bugs] Unused variable causing v3_kernel crash
José Valim
jose.valim@REDACTED
Sat Feb 2 21:42:19 CET 2013
Hello everyone,
The following module fails to compile using both R15B03-01 and R16A:
-module(sample).
-export([hello/1]).
hello(X) ->
case do_something(X) of
false ->
A = false;
Res ->
{ A, B } = Res,
do_something(A),
do_something(B)
end,
ThisShouldNotFail = A,
ok.
do_something(X) ->
external:do_something(X).
With the following exception:
crash reason: {function_clause,
[{v3_kernel,lit_vars,
[{ivalues,
[11,{file,"sample.erl"}],
[{k_var,[],ker4},{k_atom,[],ok}]}],
[{file,"v3_kernel.erl"},{line,1749}]},
{v3_kernel,uexpr,3,[{file,"v3_kernel.erl"},{line,1628}]},
{v3_kernel,ubody,3,[{file,"v3_kernel.erl"},{line,1408}]},
{v3_kernel,ubody,3,[{file,"v3_kernel.erl"},{line,1409}]},
{v3_kernel,umatch,3,[{file,"v3_kernel.erl"},{line,1716}]},
{v3_kernel,'-umatch_list/3-anonymous-0-',3,
[{file,"v3_kernel.erl"},{line,1735}]},
{v3_kernel,umatch,3,[{file,"v3_kernel.erl"},{line,1711}]},
{v3_kernel,'-umatch_list/3-anonymous-0-',3,
[{file,"v3_kernel.erl"},{line,1735}]}]}
The code and exceptions are also available here:
https://gist.github.com/7bd4eea30cd187e68caa
Removing the `ThisShouldNotFail` assignment makes it work correctly,
although I wouldn't expect it to explode with that line and just output a
couple warnings instead.
This snippet was extract from a more complex code. The name of the
functions, module and variables do not seem to affect the failure.
I tried to further debug the issue but I could not pinpoint the
failure. Let me know if I can help any further.
Thank you for your time,
*
José Valim
www.plataformatec.com.br
Founder and Lead Developer
*
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://erlang.org/pipermail/erlang-bugs/attachments/20130202/6345728e/attachment.htm>
More information about the erlang-bugs
mailing list