[erlang-bugs] Unused variable causing v3_kernel crash
Anthony Ramine
n.oxyde@REDACTED
Sun Feb 3 12:32:15 CET 2013
Hi,
I've added some details and squashed the two commits together,
please refetch.
In which suite should I put such a test case?
Regards,
--
Anthony Ramine
Le 3 févr. 2013 à 10:58, Björn Gustavsson a écrit :
> Yes, your fix seems to be correct.
>
> Do you think you could write a test case and
> provide some details in the commit message?
> (Personally I would put everything into one
> commit.)
>
> I suggest that you end your commit message
> with:
>
> Reported-by: José Valim
>
>
>
> On Sun, Feb 3, 2013 at 3:28 AM, Anthony Ramine <n.oxyde@REDACTED> wrote:
> I may have a fix for this:
>
> git fetch https://github.com/nox/otp.git fix-seq-opt
>
> https://github.com/nox/otp/compare/erlang:master...fix-seq-opt
> https://github.com/nox/otp/compare/erlang:master...fix-seq-opt.patch
>
> Your bug seems to come from the Core Erlang to Kernel Erlang pass not coping with
> multiple values into sequences' arguments, that is expressions which values aren't
> used.
>
> My branch adds a new check to core_lint to detect that kind of invalid code and
> fixes sys_core_fold so that it doesn't generate it anymore when optimizing away
> unused values.
>
> To check that this is indeed sys_core_fold's optimizations that makes the
> compilation fail, do:
>
> erlc +no_copt sample.erl
>
> To enable the Core Erlang linting pass, do:
>
> erlc +clint sample.erl
>
> Regards,
>
> --
> Anthony Ramine
>
> Le 2 févr. 2013 à 21:42, José Valim a écrit :
>
> > 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
> >
> >
> > _______________________________________________
> > erlang-bugs mailing list
> > erlang-bugs@REDACTED
> > http://erlang.org/mailman/listinfo/erlang-bugs
>
> _______________________________________________
> erlang-bugs mailing list
> erlang-bugs@REDACTED
> http://erlang.org/mailman/listinfo/erlang-bugs
>
>
>
> --
> Björn Gustavsson, Erlang/OTP, Ericsson AB
More information about the erlang-bugs
mailing list