gm2
[Top][All Lists]
Advanced

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

Re: [Gm2] More about LONGINT problem


From: Gaius Mulley
Subject: Re: [Gm2] More about LONGINT problem
Date: 05 Nov 2004 22:50:50 +0000
User-agent: Gnus/5.09 (Gnus v5.9.0) Emacs/21.2

"John B. Wallace, Jr." <address@hidden> writes:

> In my previous message I mentioned a problem with direct assignment of a
> constant to a LONGINT (or LONGCARD) variable. Here some is some test code to
> illustrate the problem:
> 
> 
> MODULE TestLong;
> 
> FROM StrIO IMPORT WriteString, WriteLn;
> 
> FROM FpuIO IMPORT StrToLongInt, WriteLongInt;
> 
> TYPE
>   String = ARRAY [0..255] OF CHAR;
> 
> VAR
>   LongIntegerVariable : LONGINT;
>   St                  : String;
> 
> BEGIN
>   LongIntegerVariable := 12345678901234;
>   WriteLongInt(LongIntegerVariable,0);
>   WriteLn;
>   St := '12345678901234';
>   WriteString(St);
>   WriteLn;
>   StrToLongInt(St,LongIntegerVariable);
>   WriteLongInt(LongIntegerVariable,0);
>   WriteLn
> END TestLong.
> 
> 
> On my system the output is:
> 
> 1942892530
> 12345678901234
> 12345678901234

Hi,

I think this is now fixed in the current cvs. Here is the latest
cvs entry, also fixed a Make-lang.in bug and added more
regression tests. The bug fix was a little more complex than
I originally expected, Modula-2 uses positive constants and
gcc defaults to signed constants, gcc also represents constants
(integer type) via two HOST_WIDE_INT (normally int or long int)
and checking for overflow etc etc was fun! It was further complicated
by 32 and 64 machines and their HOST_WIDE_INT differences.

Anyway please test!

Thanks,

Gaius


CVS entry:

* fixed bug reported by John B. Wallace, Jr <address@hidden>
  concerning assignment of a constant to a LONGINT
  (see testsuite/gm2/pim/run/TestLong.mod).
  Creation of LONGINT and LONGCARD constant literals
  was broken for values > MAX(INTEGER).



reply via email to

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