gm2
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[Gm2] Re: LENGTH() on Solaris 10/sparc


From: john o goyo
Subject: [Gm2] Re: LENGTH() on Solaris 10/sparc
Date: Sat, 24 Jul 2010 21:00:13 -0400

Andreas:

On 24-Jul-10, at 2:20 PM, Fischlin Andreas wrote:
Hi John,

Sorry, I don't quite get your issue.

On 24/Jul/2010, at 04:27 , john o goyo wrote:
Examination of the failed test cases shows a real oddity.

In a call to LENGTH(s), where s is a string, HIGH(s) is passed as zero and LENGTH(s) is always 1.


HIGH(s) is passed as zero has nothing to do with LENGTH(s).
[..]

Perhaps you are actually talking about something else, but then you should explain better what kind of oddity you actually mean.

I wrote the above in the context of gm2, specifically, in the context of the failed test cases of Length(). I shall elucidate.

In gm2, LENGTH() is defined in terms of Length() under certain circumstances. If you read the comment before the function Length() in M2RTS.mod, you will find the following.

(*
    Length - returns the length of a string, a. This is called whenever
the user calls LENGTH and the parameter cannot be calculated
            at compile time.
*)

In the failed test case iso/run/pass/tstLength.mod, the value of LENGTH(s) is compared to the value of Length(s), where "s" is an array of characters. The former is converted into a call to the latter and the latter uses HIGH(s) in its count. Unfortunately, as I wrote above, HIGH(s) is zero and consequently Length(s) returns 1, hence LENGTH(s) returns 1.

john



reply via email to

[Prev in Thread] Current Thread [Next in Thread]