compiler bug

Dietmar Schaefer dietmar@REDACTED
Tue May 3 12:53:07 CEST 2005


On the 02/14/05   mbj reported the following compiler bug !

I just got some quite simillar error !


Has this bug been fixed for R10B-4

Dietmar



Thanks!

We'll try to fix the bugs for R10B-4.

/Bjorn

mbj@REDACTED writes:


>> 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
>> -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.
>> 
>> -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