mirror of
https://gitlab.com/freepascal.org/fpc/source.git
synced 2025-08-14 20:09:27 +02:00
+ testcse3.pp
This commit is contained in:
parent
e360abb77b
commit
b856a450bd
@ -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
40
tests/testopt/testcse3.pp
Normal 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.
|
Loading…
Reference in New Issue
Block a user