[M3devel] narrow still failing..

Rodney M. Bates rodney_bates at lcwb.coop
Tue Jan 21 17:34:57 CET 2014



On 01/20/2014 10:18 PM, mika at async.caltech.edu wrote:
> Were you able to get it to fail on any of your computers?

No, the only times I got narrow failures were due to errors
in my trial cases.

I have only tried AMD64_LINUX, but should be able to get this onto a
LINUXLIBC6 system.

>
> Your Z fails for me---CM3 and PM3 both.
>
> (579)truffles:~/bsd/refany/src>../AMD64_LINUX/refany
>
>
> ***
> *** runtime error:
> ***    An explicit or implicit NARROW() operation failed.
> ***    file "../src/Main.m3", line 30
> ***

Well that torpedos both my theories.

But it is hard to imagine that bad code generated for an implicit narrow
on an assignment could ever have gone unnoticed so long.  I thought it
might be more believable if it only happened when narrowing an actual
parameter before passing it.

>
> Abort
> (580)truffles:~/bsd/refany/src>cat Mai
> Main.m3~  Main.m3
> (580)truffles:~/bsd/refany/src>cat -n Main.m3
>       1  MODULE Main;
>       2  IMPORT BDD, IO;
>       3
>       4  PROCEDURE P() : REFANY =
>       5    BEGIN
>       6      VAR x : REFANY;
>       7      BEGIN
>       8        x := BDD.New("a");
>       9        Z(x);
>      10        RETURN x
>      11      END
>      12    END P;
>      13
>      14  PROCEDURE Q() =
>      15    BEGIN
>      16      IO.Put(P() & "\n")
>      17    END Q;
>      18
>      19  (*
>      20  PROCEDURE Z(VAR x : REFANY) =
>      21    BEGIN
>      22      TYPECASE x OF
>      23        BDD.T(b) => x := BDD.Format(b)
>      24      END;
>      25    END Z;
>      26  *)
>      27  PROCEDURE Z(VAR x : REFANY) =
>      28     VAR b: BDD.T;
>      29     BEGIN
>      30       b := x;
>      31       x := BDD.Format(b)
>      32     END Z;
>      33
>      34
>      35
>      36  BEGIN
>      37    Q()
>      38  END Main.
> (581)truffles:~/bsd/refany/src>
> "Rodney M. Bates" writes:
>> What does this do?
>>
>> PROCEDURE Z(VAR x : REFANY) =
>>    VAR b: BDD.T;
>>    BEGIN
>>      b := x;
>>      x := BDD.Format(b)
>>    END Z;
>>
>> The common property of the failing cases seems to be the necessity
>> of a runtime narrow check when passing x to BDD.Format.
>>
>> So far, I haven't been able to reproduce the failure on AMD64_LINUX,
>> with even more irrelevant (one would think) stuff pared out.  I moved
>> T, Root, and Format into main, removed all but one fields of T and Root,
>> replaced BDD.New by NEW(Root) and removed Symtab and most of the body
>>from Format.
>>
>> Looking at your code, I agree it should work.
>>
>>
>> On 01/19/2014 04:01 PM, mika at async.caltech.edu wrote:
>>> As in the ISTYPE/TYPECASE example, the following works:
>>>
>>>
>>> PROCEDURE Z(VAR x : REFANY) =
>>>     BEGIN
>>>       TYPECASE x OF
>>>         BDD.T(b) => x := BDD.Format(b)
>>>       END;
>>>     END Z;
>>>
>>> (244)rover:~/refany/src>../FreeBSD4/refany
>>> a
>>>
>>>
>>> This does NOT work:
>>>
>>> PROCEDURE Z(VAR x : REFANY) =
>>>     BEGIN
>>>       TYPECASE x OF
>>>         BDD.T(b) => x := BDD.Format(x)
>>>       END;
>>>     END Z;
>>>
>>>
>>> (242)rover:~/refany/src>../FreeBSD4/refany
>>>
>>>
>>> ***
>>> *** runtime error:
>>> ***    NARROW failed
>>> ***    file "/big/home/mika/refany/src/Main.m3", line 22
>>> ***
>>>
>>>     use option @M3stackdump to get a stack trace
>>> Abort
>>>
>>>
>>> Same result PM3 / CM3.
>>>
>>>        Mika
>>>
>




More information about the M3devel mailing list