:-) ARRAYS BUG_(re)

Sun, 22 Jun 1997 04:13:10 +0200 (MET DST)


According to Bernhard Tschirren:
> 
> This is the -best- bug that I have ever found! :-) Take a look at the code
> below...
> 
> Program
>     FunnyBug;
> Type
>     PArray = ^TArray;
>     TArray = Array[0..255] Of Integer;
> Var
>     I : Integer;
>     A : PArray;
> Begin
>     New(A);
>     For I := 0 To 255 Do
>         Begin
>             A^[I]   := 10;
>             A^[(I)] := 10;  { :-) }
>         End;
>     Dispose(A);
> End.
> 
> Hehehe. I LOVE GPC's parser... 
> 
> Good Luck

Where is the bug???  My version of GPC compiles it.

In case you think that `A^[(I)]' would be illegal:  It isn't.  :-)
`(I)' is an expression in parentheses which means the same as just `I'.

    Peter

 Dipl.-Phys. Peter Gerwinski, Essen, Germany, free physicist and programmer
peter.gerwinski@uni-essen.de - http://home.pages.de/~peter.gerwinski/ [970201]
 maintainer GNU Pascal [970510] - http://home.pages.de/~gnu-pascal/ [970125]


Peter Gerwinski (peter@agnes.dida.physik.uni-essen.de)

HTML conversion by Lluís de Yzaguirre i Maura
Institut de Lingüística Aplicada - Universitat "Pompeu Fabra"
e-mail: de_yza@upf.es