Paul,
You need to specify the flag:
--classic-pascal-level-0
To get an ISO 7185 compile from GPC. Did you do that?
I completed the program (its a fragment) and compiled it with P5:
C:\projects\PASCAL\pascal-p5>p5 test
Compiling and running test
P5 Pascal compiler vs. 1.4.x
Pascal-P5 complies with the requirements of level 0 of ISO/IEC 7185.
1 -32 program test;
2 -32
3 -32 procedure test;
4 -32 type
5 -32 xHandle = ^xRecord;
6 -32 xRecord = record
7 -32 field1 : integer;
8 -32 end;
9 -32 var
10 -32 a : integer;
11 -36
12 -36 function b : xHandle;
13 -32 var
14 -32 c : xHandle;
15 -36 begin
16 3 b := c;
17 8 end;
18 9 begin
19 9 a := b^.field1;
19 **** ^6 ^104
20 13 end;
21 14
22 14 begin
23 14 end.
test unreferenced
Errors in program: 2
Error numbers in listing:
-------------------------
6 Illegal symbol
104 Identifier not declared
P5 Pascal interpreter vs. 1.4.x
Assembling/loading program
Running program
program complete
Its flagging the fact that (as you I think stated) b is a value reference and not a variable
reference, and thus applying a variable operator against it (^) is invalid in ISO 7185.
The ISO 7185 compliance of GPC is excellent; the compliance of P5 is better (not meant to
be an insult, P5 is more compliant with ISO 7185 than any other compiler in existence with
the possible exception of the model compiler, which does not exist any more). I suspect if
you try it with the above option it will give you the results you wanted.
Regards,
Scott Franco
-------- Original Message --------
Subject: ISO7185 compliance
From: Paul Isaacs <
paul@redpineinstruments.org>
Date: Thu, January 21, 2021 11:08 pm
To:
gpc@gnu.de
Hello:
gpc --classic-pascal compiles the following without error:
procedure test;
type
xHandle = ^xRecord;
xRecord = record
field1 : integer;
end;
var
a : integer;
function b : xHandle;
var
c : xHandle;
begin
b := c;
end;
begin
a := b^.field1;
end;
Is this 7185 compliant?
The right hand side of the assignment is a 6.7.3 function-designator rule :
function-designator = function-identifier [ actual-parameter-list
] .
followed by "^."
I can not see how the grammar permits the following pointer and record
accesses.
Thank you,
Paul Isaacs
_______________________________________________
Gpc mailing list
Gpc@gnu.de
https://www.g-n-u.de/mailman/listinfo/gpc