[erlang-bugs] Internal compiler error handling binaries using macro

Paulo Sérgio Almeida <>
Mon Feb 4 19:12:27 CET 2008


Hi,

when writing a parser working on binaries I came across a bug in the 
compiler. I isolated the error to the code below. This may be related to 
some error already reported here, for which there was a patch submitted; 
I am not sure. I am using an unpatched R12B.

The problem occurs on the first decode_obj clause. Moreover, if I 
replace the macro with the commented one, the error disappears.

Regards,
Paulo

---

-module(error).
-export([decode_obj/2]).

-define(WS(C), (C =:= $\s orelse C =:= $\t orelse C =:= $\n orelse C =:= 
$\r)).
%-define(WS(C), C =:= $\s; C =:= $\t; C =:= $\n; C =:= $\r).

decode_obj(<<C, R/binary>>, Acc) when ?WS(C) -> decode_obj(R, Acc);
decode_obj(<<$., _/binary>>, Acc) -> Acc;
decode_obj(<<C, R/binary>>, Acc) -> decode_obj(R, [C | Acc]).



More information about the erlang-bugs mailing list