bug0222-226

This commit is contained in:
pierre 1999-06-03 10:38:20 +00:00
parent 0e57fc0f34
commit 3c4f80fc69
5 changed files with 82 additions and 0 deletions

11
tests/tbs0222.pp Normal file
View File

@ -0,0 +1,11 @@
type TStruct = record
x,y: Integer;
end;
var i: TStruct;
begin
for i.x:=1 to 10 do
writeln(i.x);
end.

20
tests/tbs0223.pp Normal file
View File

@ -0,0 +1,20 @@
uses
erroru;
var a:string;
begin
writeln('B:'='B:'); { debbuger evaluates this to FALSE }
if 'B:'='B:' then
writeln('OK')
else
error;
a:='A:';
inc(a[1]);
writeln(a='B:'); { TRUE }
if a='B:' then
writeln('OK')
else
error;
end.

12
tests/tbs0224.pp Normal file
View File

@ -0,0 +1,12 @@
var f:text;
i:integer;
begin
assign(f,'bug0224.txt');
reset(f);
{$I-}
readln(f,i); { you can't avoid run-time error generation }
{$I+}
if IOResult<>0 then writeln('error...')
else close(f);
end.

30
tests/tbs0225.pp Normal file
View File

@ -0,0 +1,30 @@
program bug0255;
{$mode objfpc}
{$R+}
function erwwert(const feld: array of LongInt):extended;
var i: LongInt;
begin
Result:=0;
for i:=low(feld) to high(feld)
do begin
writeln(i); // gives "0"
Result:=Result+feld[i];
end; //^^^^^^^ there occurs the segfault (216)
// on the first loop
Result:=Result/(high(feld)-low(feld)+1);
end;
var werte: array[0..299] of LongInt;
i: LongInt;
begin
//init the array
for i:=0 to 299
do werte[i]:=Random(5)-2;
//and do something with it
writeln(erwwert(werte):6:5);
end.

9
tests/tbs0226.pp Normal file
View File

@ -0,0 +1,9 @@
{$ifdef fpc}{$asmmode intel}{$endif}
var
test : longint;
begin
exit; { don't run this code below !! }
asm
dd test
end;
end.