[M3devel] compiler bug

Rodney M. Bates rodney_bates at lcwb.coop
Tue Jan 19 21:13:40 CET 2016


That's almost what I did, except as below.  Since i is passed to a
CARDINAL in the line below, the i=zero case would not suffer the RT
fault.  It would give 0,0 as bounds of the being-compiled Extract,
which seems right to me.

On 01/19/2016 12:36 PM, Hosking, Antony L wrote:
> Can you try this version of Extract.GetBounds?
>
> PROCEDURE GetBounds (ce: CallExpr.T;  VAR min, max: Target.Int) =
>    VAR min_bits, max_bits: Target.Int;  i: INTEGER;
>    BEGIN
>      Expr.GetBounds (ce.args[2], min_bits, max_bits);
>      IF TInt.ToInt (max_bits, i) AND i > 0 AND  i < Word_types[rep].size THEN
      ..............................AND 0 <= i .................................
>        IF NOT TWord.Extract (TInt.MOne, 0, i, max) THEN
>          EVAL Type.GetBounds (T, min, max);
>        END;
>        min := TInt.Zero;
>      ELSE
>        (* possible that we'll preserve all bits *)
>        Expr.GetBounds (ce.args[0], min, max);
>      END;
>    END GetBounds;
>
>> On 19 Jan 2016, at 1:09 PM, Rodney M. Bates <rodney_bates at lcwb.coop> wrote:
>>
>> I have a simple fix that made this RT crash go away, but now I can't rebuild
>> the libraries/compiler from all source, with different symptoms for different
>> methods.
>>
>> On 01/17/2016 10:01 PM, Peter McKinna wrote:
>>> This is unusual.
>>>
>>> PROCEDURE Test() =
>>>    VAR x,m := 1;
>>>    BEGIN
>>>      x := Word.Extract(x,m,n);
>>>    END Test;
>>>
>>> induces
>>>
>>> new source -> compiling test.m3
>>> "../src/test.m3", line 190: undefined (n)
>>>
>>>
>>> ***
>>> *** runtime error:
>>> ***    An enumeration or subrange value was out of range.
>>> ***    file "../AMD64_LINUX/WordExtract.m3 => ../src/builtinWord/Extract.mg", l
>>> ine 120
>>> ***
>>>
>>> Aborted (core dumped)
>>>
>>>
>>> fix the undefined n and it compiles ok.
>>>
>>> Any takers to fix this?
>>>
>>> Should have a bug tracking system really.
>>>
>>> Peter
>>>
>>>
>>>
>>> _______________________________________________
>>> M3devel mailing list
>>> M3devel at elegosoft.com
>>> https://mail.elegosoft.com/cgi-bin/mailman/listinfo/m3devel
>>>
>>
>> --
>> Rodney Bates
>> rodney.m.bates at acm.org
>> _______________________________________________
>> M3devel mailing list
>> M3devel at elegosoft.com
>> https://mail.elegosoft.com/cgi-bin/mailman/listinfo/m3devel
>
>

-- 
Rodney Bates
rodney.m.bates at acm.org



More information about the M3devel mailing list