compiler bug
mbj@REDACTED
mbj@REDACTED
Mon Feb 14 14:06:36 CET 2005
Hi,
Here's another module with the same behaviour - just to show that this
has nothing to do with records...
Run:
1> xx2:y().
{nok,{bar,1}}
If you remove the call to noop/1, you'll get ok.
I'd say that this is a rather serious bug.
/martin
mbj@REDACTED wrote:
> Hi,
>
> I've found a bug in the compiler, same in R10B-2 and 3. Seems to work
> fine in R9.
>
> Run xx:y() and you'll get
>
> ** exited: {{badrecord,bar},
> [{xx,x,1},
>
> If e.g. the call to noop is removed it works fine.
>
>
> While trying to isolate this error into a small example module, I
> found another bug. Compiling zz.erl gives:
>
> zz: function x/1+25:
> Internal consistency check failed - please report this bug.
> Instruction: {get_tuple_element,{y,2},2,{x,0}}
> Error: {bad_type,{needed,{tuple_element,3}},{actual,{tuple,[2]}}}:
>
>
>
> I'm running on linux, normal erlang installation.
>
>
>
> /martin
-------------- next part --------------
-module(xx2).
-compile(export_all).
-record(bar, {status}).
y() ->
x({foo, 1}).
get_bar() ->
{bar, 1}.
x(Trans) ->
{foo, Barno} = Trans,
case get_bar() of
Bar when element(2, Bar) == 1 ->
noop(Bar),
case Bar of
{bar, _} ->
ok;
_ ->
{nok, Bar}
end;
_ ->
Trans
end.
noop(_) ->
ok.
More information about the erlang-questions
mailing list