gm2
[Top][All Lists]
Advanced

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

Re: [Gm2] Array and CAST Woes


From: Gaius Mulley
Subject: Re: [Gm2] Array and CAST Woes
Date: 17 Jun 2005 17:27:53 +0100
User-agent: Gnus/5.09 (Gnus v5.9.0) Emacs/21.4

john o goyo <address@hidden> writes:

> Greetings:
> 
> I offer the following report.
> 
> ------------------------------------------------------------
> 1. Array indices:
> 
> Methinks that the following is correct code but gm2 claims
> otherwise.
> 
> ===[index.mod]===
> MODULE index;
> 
> TYPE
>      A = ARRAY [0..1] OF CHAR;
> VAR
>      a :ARRAY [0..1] OF A;
> 
> BEGIN (*index*)
>      a[0,0] := 'A'  (* Reported as error by GM2 of 2005-06-03 *)
> END index.
> ===[index.mod ends]===

Hi John,

thanks for the test code (indeed a bug).. I've not yet fixed this

> ------------------------------------------------------------
> 2. CASTing woes:
> 
> Is the following not valid?
> 
> ===[cast.mod]===
> MODULE cast;
> 
> FROM SYSTEM IMPORT CAST, LOC;
> 
> VAR
>      x :LOC;
>      n :CARDINAL;
> 
> BEGIN
>      n := 2;
>      x := CAST(LOC, n)  (* Reported as error by GM2 of 2005-06-03 *)
> END cast.
> ===[cast.mod ends]===

again thanks for the test code and bug report. I have fixed this and
I've also included another command line option -Wpedantic-cast which
generates a warning if a cast is converting data of one size to
another. By default this switch is disabled as one would expect -
though I think it useful as some users might prefer to use VAL to
convert different sized objects and CAST to perform a change in same
sized objects. This might be useful and save users from problems for
example if one were to CAST(INTEGER, var) and var was declared as
an ADDRESS on a LP64 machine.

I've added your test cases to the regression tests - currently the
index tests cause gm2 to fail - this will prompt me to fix the next
bug :-)

Thanks Gaius




reply via email to

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