Browse Source

test that range check is not restored too early

pierre 25 years ago
parent
commit
8f02af8161
1 changed files with 24 additions and 0 deletions
  1. 24 0
      tests/test/testrang.pp

+ 24 - 0
tests/test/testrang.pp

@@ -0,0 +1,24 @@
+
+var x : byte;
+      y : longint;
+
+procedure set_x;
+begin
+   y:=345;
+  {$R-}
+    x:=y;
+  {$R+}
+    Writeln('x = ',x);
+  {$R-}
+    x:=y
+  {$R+}
+end;
+{ the bug comes from the fact that as there is no
+semicolon after x:=y the parser must read up to end; statement
+and thus change the range check mode before
+the assign node is created !! }
+
+begin
+  set_x;
+  Writeln('x = ',x);
+end.