[Top][All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: [Gm2] StringConvert dialect
From: |
Gaius Mulley |
Subject: |
Re: [Gm2] StringConvert dialect |
Date: |
11 Nov 2005 00:59:18 +0000 |
User-agent: |
Gnus/5.09 (Gnus v5.9.0) Emacs/21.4 |
John B Wallace Jr <address@hidden> writes:
> There seems to be a slight problem with the StringConvert module. It appears
> that it is written in the PIM2/PIM3 dialect and when compiled with the default
> dialect of the most recent gm2 (PIM4 I believe), it produces some errors.
>
>
> The two test modules below produce an incorrect result for MIN(INTEGER) and
> MIN(LONGINT) when built with the 16Sep05 version of gm2:
>
>
> MODULE InOutBug;
>
> (*******************************************************************)
> (* NOTE: THIS IS TEST CODE AND MAY BE INCORRECT *)
> (*******************************************************************)
>
> FROM InOut IMPORT WriteInt, WriteLn;
>
> BEGIN
> WriteInt(MAX(INTEGER),0);
> WriteLn;
> WriteInt(MIN(INTEGER),0);
> WriteLn;
> WriteInt(MIN(INTEGER)+1,0);
> WriteLn
> END InOutBug.
>
> The output is:
>
> 2147483647
> -2147483658
> -2147483647
>
>
> MODULE FpuIOBug;
>
> (*******************************************************************)
> (* NOTE: THIS IS TEST CODE AND MAY BE INCORRECT *)
> (*******************************************************************)
>
> FROM StrIO IMPORT WriteLn;
>
> FROM FpuIO IMPORT WriteLongInt;
>
> BEGIN
> WriteLongInt(MAX(LONGINT),0);
> WriteLn;
> WriteLongInt(MIN(LONGINT),0);
> WriteLn;
> WriteLongInt(MIN(LONGINT)+1,0);
> WriteLn
> END FpuIOBug.
>
> The output is:
>
> +9223372036854775807
> -9223372036854775818
> -9223372036854775807
>
>
> I was able to correct the problem by compiling the StringConvert
> module with the -Wpim2/-Wpim3 switch or by changing the StringConvert
> code very slightly, replacing a few DIV with / and a few MOD with REM
> in the first part of the IntegerToString and LongIntegerToString procedures.
>
> The NumberIO module may have the same problem.
Hi John,
many thanks for reporting these bugs - they have all been fixed now
and checked into the current CVS together with runtime regression
tests. As you suggested there was a similar bug in NumberIO
which has also been fixed,
regards,
Gaius
[Prev in Thread] |
Current Thread |
[Next in Thread] |
- Re: [Gm2] StringConvert dialect,
Gaius Mulley <=