ISO 7185 test failures

Russell Whitaker russ at ashlandhome.net
Fri Nov 23 01:21:54 CET 2007



On Thu, 22 Nov 2007, Scott Moore wrote:

> {******************************************************************************
>
> GPC standard ISO 7185 test failures
>
> The following failures were found:
>

using latest gpc snapshot, gpc-20070904, the following error was gone:

> fails.pas:93: error: ISO 7185 Pascal allows only simple constants

[..]

> ===============================================================================
> C:\GPC\usr\test>gpc -Wno-warnings -o fails fails.pas
>
> C:\GPC\usr\test>fails
> 1
> 10
> 100
> 2147483647
> True
> False
> ===============================================================================
>
> This appears to indicate the default fields for integer is set to 1.

As I see it, the default length is not 1, per se, but the length necessary
to print the value as a string.

> This is
> technically valid, but clearly preverts the intent of the language. The
> "Pascal users manual and report" shows several examples of the field for
> integer being clearly set to the maximum size of integer. Ie., for a maximum
> integer of 11 digits including the sign (for +/-2147483647) the default 
> should
> be 11 digits for integer. The output of numbers in collumns under the
> assumption that they would correctly spaced for all integers would fail under
> the current GPC (see again the several examples in the "report"). I have had
> the discussion with another implementor, and this treatment of defaults falls
> under "techically valid (by the ISO 7185 standard), but would break examples
> of the original Pascal as formulated by Wirth", which I consider a quality
> issue.
>
> There is no explaination for the values of boolean. Since they are treated as
> the strings "true" or "false", there is no possible default field that would
> deliver the results shown. If the default were 5 (size of 'false') the result
> would be:
>
Again, the default is the lenght of the string necessary to print the 
value.

[..]
>
> Here is a -v dump on the GPC used:
>
[..]
> gpc version 20051116, based on gcc-3.4.4
>
> program fails(output);
>
> const scst = 'this is a string';
>
> type cset  = set of char;
>     prec = packed record
>
>              i:   integer;
>              b:   boolean;
>              c:   char;
>              r:   real;
>              stc: cset;
>
>           end;
>
> var i: integer;
>    pavs:  packed array [1..10] of cset;
>    parec: prec;
>
> begin
>
>   for i := 1 to 10 do pavs[i] := [chr(i+ord('a'))];
>   parec.stc := ['b'..'e', 'i'];
>   writeln(1);
>   writeln(10);
>   writeln(100);
>   writeln(maxint);
>   writeln(true);
>   writeln(false)
>
> end.
>

My .02
   Russ





More information about the Gpc mailing list