+ testcse3.pp

This commit is contained in:
Jonas Maebe 2000-06-03 09:43:24 +00:00
parent e360abb77b
commit b856a450bd
2 changed files with 41 additions and 0 deletions

View File

@ -6,3 +6,4 @@ Register variables:
Common subexpression elimination (assembler) Common subexpression elimination (assembler)
Multidimensional array index operation. testcse1.pp Multidimensional array index operation. testcse1.pp
CSE and range checking ................ testcse2.pp CSE and range checking ................ testcse2.pp
web bug 972............................ testcse3.pp

40
tests/testopt/testcse3.pp Normal file
View File

@ -0,0 +1,40 @@
{ $OPT=-O2}
function forms(s: string; len: word): string;
begin
str(len,forms);
forms := s + ', ' + forms;
end;
procedure wrt2(s: string);
begin
if s <> 'e 123, 4' then
begin
writeln('bug!');
halt(1);
end;
end;
type
pstring = ^string;
ta = array[0..254] of pstring;
tb = array[0..254] of byte;
procedure t(var sel: ta; var selhigh: tb);
var
ml, i: byte;
begin
i := 5;
ml := 8;
new(sel[i]);
sel[i]^ := 'testje 123';
selhigh[i] := 5;
wrt2(forms(copy(sel[i]^,selhigh[i]+1,255),ml-selhigh[i]+1));
end;
var
a: ta;
b: tb;
begin
t(a,b);
end.