No subject

mbj@REDACTED mbj@REDACTED
Mon Feb 14 09:12:01 CET 2005


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(zz).
-compile(export_all).

-record(bar, {status, vs = []}).

y() ->
    x({foo, 1, []}).

get_bar() ->
    #bar{status = 1}.

x(Trans) ->
    {foo, Barno, _} = Trans,
    case get_bar() of
	Bar when Bar#bar.status /= 2 ->
	    if 1 == 1 ->
		    mnesia:dirty_delete({bar, Barno}),
		    Vs = [1,2] ++ Bar#bar.vs,
		    Bar33 = Bar#bar{status = 1},
		    Bar1 = Bar#bar{status = 3,
				   vs = Vs},
		    [{payment, Barno}];
	       true ->
		    Barno
	    end;
	_ ->
	    Trans
    end.

-------------- next part --------------
-module(xx).
-compile(export_all).

-record(bar, {status}).

y() ->
    x({foo, 1}).

get_bar() ->
    #bar{status = 1}.

x(Trans) ->
    {foo, Barno} = Trans,
    case get_bar() of
	Bar when Bar#bar.status == 1 ->
	    noop(Bar),
	    Bar33 = Bar#bar{status = 1},
	    {ok, Bar33, Barno};
	_ ->
	    Trans
    end.

noop(_) ->
    ok.


More information about the erlang-questions mailing list