[erlang-bugs] Compiler bug in sys_core_fold.erl

Robert Virding rvirding@REDACTED
Wed Oct 8 15:44:18 CEST 2008


I am running R12B-4 and have generated code with Lisp Flavoured Erlang.

There is a bug in eval_element/3 which is called from fold_call/4 which
tries to safely evaluate calls at compile time. Eval_element tries to
evaluate calls to element/2. It also tries to check if the call is
guaranteed to fail in which case it replaces the original call with a call
to erlang:error(badarg). It is this check which is causing the bug as it is
so tuned to code generated by the vanilla erlang compiler that it does not
accept a nested call in the element. This is the bug.

I would also argue that such a substitution has very little noticeable
effect as any evaluation of the arguments to element/2 have been broken out
and will already be evaluated before the code ever reaches the erlang:error
call. It, in fact, saves very little.

Robert
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://erlang.org/pipermail/erlang-bugs/attachments/20081008/4ba65cce/attachment.htm>


More information about the erlang-bugs mailing list