Two bugs

Thu, 20 Mar 1997 12:40:25 +0100



{ Propably any bug in gpc 2.0 (GNU Pascal) }

program Bug1(Input,Output);

type
 Str255=String(255);

procedure Gogo(S:String; var SOut:Str255);
 begin
  WriteLn(' Before Error ');
  SOut:='aha';      { ! ?GPC runtime error: runtime error (#-1) ! }
  WriteLn(' After Error ');
 end;

var
 S:Str255;
begin
 S:='1234';
 Gogo(S,S);
end.

{ Bug #2 ! }
program Bug2(Input,Output);

type
 Str255=String(255);
var
 I:Integer;

function Gogo(S:String):Str255;
 begin
  WriteLn(' Gogo ');
  Inc(I);
  Gogo:=S;
 end;

var
 S:Str255;
begin
 I:=0;
 S:='1234';
 S:=Gogo(S); { ! No one call Gogo bat three calls ! }
 WriteLn(I); { ! I=3   I!=0 }
end.

{ Please send my if you know any solution 
  srbt@fsid.cvut.cz }
.


Tomas Srb (srbt@ahimsa.fsid.cvut.cz)

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