[erlang-bugs] Compiler bug in R12B
Simon Cornish
zl9d97p02@REDACTED
Thu Jan 10 08:23:46 CET 2008
Hi,
The R12B compiler (even the latest -1 snapshot) barfs at this simple
Erlang program - a.erl
The problem is that match context from the first clause overwrites the
register holding the binary.
The fault probably lies in v3_codegen:bsm_rename_ctx/2 or the
annotation logic in sys_core_fold.
My work around (v3_codegen.patch) was to bypass the reuse optimisation.
The resulting S file from compiling a.erl with the patched v3_codegen
module is also attached.
One thing to note from this is that now {x,1} never contains a match
context when label 4 is reached.
I don't know if this is an artefact of my workaround or another bug.
Fortunately, the code works because the beam emulator basically
ignores this operation if the register doesn't contain a match
context.
Have fun fixing this.
/Simon
-------------- next part --------------
A non-text attachment was scrubbed...
Name: a.erl
Type: application/octet-stream
Size: 80 bytes
Desc: not available
URL: <http://erlang.org/pipermail/erlang-bugs/attachments/20080109/19c58a4d/attachment.obj>
-------------- next part --------------
A non-text attachment was scrubbed...
Name: v3_codegen.patch
Type: application/octet-stream
Size: 399 bytes
Desc: not available
URL: <http://erlang.org/pipermail/erlang-bugs/attachments/20080109/19c58a4d/attachment-0001.obj>
-------------- next part --------------
A non-text attachment was scrubbed...
Name: a.S
Type: application/octet-stream
Size: 1005 bytes
Desc: not available
URL: <http://erlang.org/pipermail/erlang-bugs/attachments/20080109/19c58a4d/attachment-0002.obj>
More information about the erlang-bugs
mailing list