Bug in stdlib

Kostis Sagonas <>
Fri Mar 4 15:51:36 CET 2005


Dialyzer found what we think is possibly a serious bug
in stdlib/src/erl_eval.erl

It complains about:

{erl_eval,do_apply,5}: Fun application using type an atom instead of a fun!
{erl_eval,do_apply,5}: Fun application using type an atom instead of a fun!

In the first clause, the same variable F is used in two distinct
ways: one in the head and in the patterns of the case statements.
We *think* that the variable in the case patterns should be
something else (e.g. F1).

=======================================================================
do_apply({M,F}=Func, As, Bs0, Ef, RBs)
  when is_tuple(M), size(M) >= 1, is_atom(element(1, M)), is_atom(F) ->
    case Ef of
        none when RBs == value ->
            %% Make tail recursive calls when possible.
            apply(M, F, As);
        none ->
            ret_expr(apply(M, F, As), Bs0, RBs);
        {value,F} when RBs == value ->
            F(Func, As);
        {value,F} ->
            ret_expr(F(Func, As), Bs0, RBs)
    end;
=======================================================================

Best,
Kostis




More information about the erlang-bugs mailing list