[erlang-questions] Binary pattern matching inconsistencies with R12B
Kostis Sagonas
kostis@REDACTED
Fri Feb 29 20:32:24 CET 2008
Rory Byrne wrote:
>
> I'm writing a scanner for a query language and I'm encountering
> intermittent segmentation faults and other odd errors. The
> code I'm working on appears to work fine on 11.b.2-4
> (linux/amd64), but gives problems on r12b-0 (linux/i386) and
> r12b-1 (linux/amd64). I didn't add any fancy options when I
> compiled r12b, just a --prefix.
>
> I'm an erlang newbie so highly likely I've written something
> stupid. Just hope it's obvious whatever it is!
>
> ... SNIP
>
> Anyone got any ideas?
I confirm your experiences. Mine are slightly different than yours, but
the end results are the same; see below. This is with the most recent
development version. I suspect a GC-related.
Kostis
PS. Surprisingly, I cannot manage to get a seg-fault if I compile
to native code. [using hipe:c() instead of c()]
========================================================================
Erlang (BEAM) emulator version 5.6.2 [source] [async-threads:0] [hipe]
[kernel-poll:false]
Eshell V5.6.2 (abort with ^G)
1> c(weird).
{ok,weird}
2> weird:run(10000).
ok
3> weird:run(10000).
ok
4> weird:run(10000).
ok
5> weird:run(10000).
ok
6> weird:run(10000).
ok
7> weird:run(10000).
ok
8> weird:run(10000).
ok
9> weird:run(10000).
ok
10> weird:run(10000).
ok
11> weird:run(10000).
ok
12> weird:run(10000).
ok
13> weird:run(10000).
ok
14> weird:run(10000).
ok
15> weird:run(10000).
ok
16> weird:run(10000).
ok
17> weird:run(10000).
ok
18> weird:run(10000).
ok
19> weird:run(10000).
ok
20> weird:run(10000).
ok
21> weird:run(10000).
ok
22> weird:run(10000).
ok
23> weird:run(10000).
ok
24> weird:run(100).
** exception error: no function clause matching weird:scan(<<"whatever">>,
[{'FIELD',110},
{'KEYWORD',111},
{'KEYWORD',105},
{'KEYWORD',103},
{'KEYWORD',101},
{'KEYWORD',114}])
in function lists:foreach/2
25> weird:run(100).
ok
26> weird:run(100).
ok
27> halt().
@statler [~/HiPE/otp] hipe
Erlang (BEAM) emulator version 5.6.2 [source] [async-threads:0] [hipe]
[kernel-poll:false]
Eshell V5.6.2 (abort with ^G)
1> c(scanner).
{ok,scanner}
2> scanner:run(100).
ok
3> scanner:run(100).
Segmentation fault
More information about the erlang-questions
mailing list