{******************************************************************************
GPC standard ISO 7185 test failures
The following failures were found:
=============================================================================== C:\GPC\usr\test>gpc --standard-pascal -Wno-warnings -o fails fails.pas fails.pas:93: error: ISO 7185 Pascal allows only simple constants fails.pas: In main program: fails.pas:112: error: this use of packed array components is an extension of fails.pas:112: error: Borland Pascal, traditional Macintosh Pascal fails.pas:113: error: this use of packed record fields is an extension of Borland fails.pas:113: error: Pascal, traditional Macintosh Pascal ===============================================================================
None of these are valid failures, or indeed even have a reasonable explaination in the standard. Also, all of these used to work fine in GPC:
GNU Pascal version 2.1 (20020510), based on gcc-2.95.3-6 (mingw special)
See the testing details for that compiler:
http://www.moorecad.com/standardpascal/compiler.html
Now, with "--standard-pascal" off:
=============================================================================== 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. 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:
True False
For 4 (size of 'true') it would be:
True Fals
I tried this also with the "--standard-pascal" flag on (by commenting out the error causing statements), and got the same result.
Again, this used to pass:
GNU Pascal version 2.1 (20020510), based on gcc-2.95.3-6 (mingw special)
Here is a -v dump on the GPC used:
=============================================================================== C:\GPC\usr\test>gpc -v Reading specs from /ecos-c/gpc/usr/bin/../lib/gcc/i686-pc-cygwin/3.4.4/specs Configured with: ../configure --verbose --prefix=/usr --exec-prefix=/usr --sysco nfdir=/etc --libdir=/usr/lib --libexecdir=/usr/lib --mandir=/usr/share/man --inf odir=/usr/share/info --enable-languages=c,pascal --enable-nls --without-included -gettext --enable-version-specific-runtime-libs --without-x --enable-libgcj --di sable-java-awt --with-system-zlib --enable-interpreter --disable-libgcj-debug -- enable-threads=posix --enable-java-gc=boehm --disable-win32-registry --enable-sj lj-exceptions --enable-hash-synchronization --enable-libstdcxx-debug Thread model: posix 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.
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
Russell Whitaker wrote:
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.
I'm sure it is a reasonable implementation. However, it does not match the ISO 7185 standard. It used to. What it is doing is matching Borland mode, so it appears that someone changed it to match Borland mode. That's fine, but there should exist a flag to change it back to ISO 7185 mode (as indeed the standard requires). For more information on the exact methods the standard requires to format ISO 7185 data, I recommend reading the standard itself.
In addition, it very clearly breaks the original examples that Wirth himself published with Pascal.
Scott Moore
On Thu, 22 Nov 2007, Scott Moore wrote:
Russell Whitaker wrote:
On Thu, 22 Nov 2007, Scott Moore wrote:
=============================================================================== 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.
I'm sure it is a reasonable implementation. However, it does not match the ISO 7185 standard.
Earlier today googled for iso7185 and iso10206:
ISO/IEC 7185:1990(E), in section 6.9.3.1:
"Write(f,e) shall be equivalent to the form write(f,e : TotalWidth), using a default value for TotalWidth that depends on the type of e for integer-type, real-type, and Boolean-type, the default values shall be implementation-defined."
ISO10206 has the same text but re-numbered to 6.10.3.1
I'd like to point out that if you made the TotalWidth default to 10 for integers and used the default then you would get leading spaces for numbers less than 10 digits, or sign + nine.
That suggests if you wanted the original behavior, you may need something like write(f,e:length(e))
Do you really want that behavior?
Russ