gm2
[Top][All Lists]
Advanced

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

Re: [Gm2] Some bugs in 1.0


From: Gaius Mulley
Subject: Re: [Gm2] Some bugs in 1.0
Date: Sat, 18 Dec 2010 16:00:34 +0000
User-agent: Gnus/5.13 (Gnus v5.13) Emacs/23.2 (gnu/linux)

Dmitry Shatrov <address@hidden> writes:

> Hi list,
>
> I've got two supposed bugs and one feature request. I've collected these from
> my effort to compile an old program for JPI TopSpeed Modula-2 with gm2. Here 
> we
> go:
>
>
> 1. The following segfaults. It looks like aliases are broken:
>
> MODULE test;
>
> (* Uncommenting this doesn't help
> VAR
>     my_var : CARDINAL;
> *)
>
> CONST my_alias = test.my_var;
>
> BEGIN
> END test.

Hi Dmitry,

any thanks for the bug report - certainly a bug which is now under
investigation,

> 2. The following doesn't compile, i.e. we cannot pass a char as a parameter if
> the function that we're calling expects a string. As far as I know, ISO says
> that this should be allowed (JPI allows that as well).
>
> MODULE test;
>
> PROCEDURE my_func (str : ARRAY OF CHAR);
> BEGIN
> END my_func;
>
> BEGIN
>     my_func (261C);
> END test.

and thanks again - this is a bug which I'll fix.

> 3. (A feature request, I guess) The old code contains lots (lots!) of casts
> that gm2 disallows because of different source and destination type sizes.
> Perhaps there could be an option to allow such casts? Here's an example:
>
> MODULE test;
>
> VAR
>     my_char : CHAR;
>     my_card : CARDINAL;
>
> BEGIN
>     my_char := 0C;
>
>     my_card := VAL (CARDINAL, my_char); (* THIS WORKS IN GNU Modula-2
>     *)
ok

>     my_card := CARDINAL (my_char);      (* THIS WORKS IN JPI TopSpeed
>     Modula-2

maybe - but I believe it to be incorrect as it is confusing type cast
with type conversion.  The above example would be better written:

   my_card = ORD(my_char)

in PIM4 the use of CARDINAL(x) , INTEGER(x), BITSET(x) mean that no
conversion is undertaken (and my_card := CARDINAL(my_char) would force
an 8 to 32 bit copy on x86_* systems).  I cannot immediately see what
ISO says about this, but ISO provides both SYSTEM.CAST and VAL (as well
as ORD, CHR).  Richard Sutcliffe's site seems to imply that it is
illegal as well - although I stand to be corrected :-)

 
http://arjay.bc.ca/Modula-2/Text/index.html?http://arjay.bc.ca/Modula-2/Text/Ch2/Ch2.10.html
 [2.10 Type Compatibility and REAL]

regards,
Gaius


> *)
> END test.
>
>
>
> Best regards,
> Dmitry
> _______________________________________________
> gm2 mailing list
> address@hidden
> http://lists.nongnu.org/mailman/listinfo/gm2



reply via email to

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