diff --git a/tests/testopt/readme.txt b/tests/testopt/readme.txt index aeacd80010..75c3e310b5 100644 --- a/tests/testopt/readme.txt +++ b/tests/testopt/readme.txt @@ -2,5 +2,6 @@ This directory contains some tests which test the optimizer Register variables: Enumerations .......................... testreg1.pp Readln ................................ testreg2.pp + Range checking ........................ testreg3.pp Common subexpression elimination (assembler) Multidimensional array index operation. testcse1.pp diff --git a/tests/testopt/testreg3.pp b/tests/testopt/testreg3.pp new file mode 100644 index 0000000000..1758e2958a --- /dev/null +++ b/tests/testopt/testreg3.pp @@ -0,0 +1,33 @@ +{ $OPT=-Or} +program rangecse; + +{$r+} + +type + pa = ^ta; + ta = array[0..100] of longint; + +procedure t; +var + i, j: longint; + p: pa; +begin + new(p); + fillchar(p^,101*sizeof(longint),0); + p^[100] := 5; + j := 5; + for i:=1 to 101 do + if j=p^[i-1] then + begin + writeln('found!'); + dispose(p); + exit; + end; + writeln('failed..'); + dispose(p); + halt(1); +end; + +begin + t; +end. \ No newline at end of file