Hello,
There is a small bug in the implementation of array's. See the following example program:
PROGRAM test(input, output);
TYPE RealVectorT(b,e:integer) =ARRAY[b..e] OF Real; RealMatrixT(br,er,bc,ec:integer) =ARRAY[br..er] OF RealVectorT(bc,ec);
VAR x:RealMatrixT(1,5,1,5);
BEGIN x[1,1]:=0; { error: test.p: In function `pascal_main_program': test.p:10: subscripted object is not an array or string } x[1][1]:=0; { this is O.K. } END.
Both implementations of addressing an array element x[1,1] and x[1][1] should be equivalent. In the first case the compiler does not interpret x as an array. The latter version is correctly interpreted and executed.
I have used the relase 2.95.2 19991024 of gpc.
With kind regards,
Rudy Moddemeijer
--------------------------------------------------------------------- | R. Moddemeijer | Department of Computing Science | | | University of Groningen | | Phone +31/50 - 363 3940 | Blauwborgje 3 room IWI 228 | | Telefax +31/50 - 363 3800 | P.O. Box 800 | | e-Mail rudy@cs.rug.nl | NL-9700 AV Groningen | | r.moddemeijer@cs.rug.nl | The Netherlands | | | | ---------------------------------------------------------------------
Rudy Moddemeyer wrote:
There is a small bug in the implementation of array's. See the following example program:
PROGRAM test(input, output);
TYPE RealVectorT(b,e:integer) =ARRAY[b..e] OF Real; RealMatrixT(br,er,bc,ec:integer) =ARRAY[br..er] OF RealVectorT(bc,ec);
VAR x:RealMatrixT(1,5,1,5);
BEGIN x[1,1]:=0; { error: test.p: In function `pascal_main_program': test.p:10: subscripted object is not an array or string } x[1][1]:=0; { this is O.K. } END.
Both implementations of addressing an array element x[1,1] and x[1][1] should be equivalent. In the first case the compiler does not interpret x as an array. The latter version is correctly interpreted and executed.
Thanks for the report (rudy1.pas). The problematic code (gpc-typeck.c:2207) is marked `@@@' which might mean that it's a known problem to Peter...
Frank
Frank Heckenbach wrote:
x[1,1]:=0; { error: test.p: In function `pascal_main_program':
Thanks for the report (rudy1.pas). The problematic code (gpc-typeck.c:2207) is marked `@@@' which might mean that it's a known problem to Peter...
In fact this was unrelated but however it pointed me to the real problem - fortunately a really easy one. :-)
It's fixed in the CVS now.
Peter