Browse Source

+ Discovered a bug regarding string bounds checking, add tests for it.

git-svn-id: trunk@7823 -
daniel 18 years ago
parent
commit
eef2d4a1df
3 changed files with 36 additions and 0 deletions
  1. 2 0
      .gitattributes
  2. 17 0
      tests/tbf/tb0200.pp
  3. 17 0
      tests/tbf/tb0201.pp

+ 2 - 0
.gitattributes

@@ -5798,6 +5798,8 @@ tests/tbf/tb0197.pp svneol=native#text/plain
 tests/tbf/tb0198.pp svneol=native#text/plain
 tests/tbf/tb0199.pp -text
 tests/tbf/tb0199a.pp -text
+tests/tbf/tb0200.pp svneol=native#text/x-pascal
+tests/tbf/tb0201.pp svneol=native#text/x-pascal
 tests/tbf/ub0115.pp svneol=native#text/plain
 tests/tbf/ub0149.pp svneol=native#text/plain
 tests/tbf/ub0158a.pp svneol=native#text/plain

+ 17 - 0
tests/tbf/tb0200.pp

@@ -0,0 +1,17 @@
+program tb0200;
+
+{$H-}
+
+{TP rejects this code both with range checking off and on. However,
+ we allow indexing arrays out of bounds with range checks off, so
+ we best reject this then only with range checking on.}
+
+{$Q+,R+}
+
+var a:string;
+    c:char;
+
+begin
+  a:='';
+  c:=a[257];
+end.

+ 17 - 0
tests/tbf/tb0201.pp

@@ -0,0 +1,17 @@
+program tb0200;
+
+{$H-}
+{$Q+,R+}
+
+var a:string;
+    b:string[63];
+    c:char;
+    w:word;
+
+begin
+  a:='';
+  b:='';
+  w:=257;
+  c:=a[w];
+  c:=b[w];
+end.