Redirecting functions calls ?

Bjorn Gustavsson <>
Fri Apr 23 11:31:06 CEST 2004


The bug has been corrected in our R10B development branch.

If our paying customers would find it necessary, we will also
release a compiler patch for R9C.

The second function (wow/1 in this case) will never be correctly
executed. There will always be a function clause exception. The only
really bad case is if the second function expects more arguments than
the first function - in that case the emulator could crash.

/Bjorn

Sean Hinde <> writes:

> Hi,
> 
> Actually this is almost possible - I discovered a compiler bug just
> today:
> 
> -module(compiler_bug).
> -export([test/1, wow/1]).
> 
> test(A) when fred ->
>      {ok, A}.
> 
> wow(A) ->
>      wow.
> 
> This compiles fine. Trying this out:
> 
> 175> compiler_bug:test(1).
> 
> =ERROR REPORT==== 22-Apr-2004::23:11:45 ===
> Error in process <0.1000.0> on node '' with exit
> value:
> {function_clause,[{compiler_bug,wow,[1]},{erl_eval,do_apply,5},{shell,ev
> al_loop,2}]}
> 
> ** exited: {function_clause,[{compiler_bug,wow,[1]},
>                               {erl_eval,do_apply,5},
>                               {shell,eval_loop,2}]} **
> 
> I haven't managed to make it correctly call wow(1), but the error
> report suggests that my call to test/1 did indeed result in a call to
> wow/1
> 
> :-)
> 
> Sean
> 

-- 
Björn Gustavsson, Erlang/OTP, Ericsson AB



More information about the erlang-questions mailing list