Browse Source

* check whether loop counters are valid for assignment (bug 4695)

git-svn-id: trunk@2285 -
Jonas Maebe 19 years ago
parent
commit
09a668dac9
3 changed files with 15 additions and 0 deletions
  1. 1 0
      .gitattributes
  2. 1 0
      compiler/pstatmnt.pas
  3. 13 0
      tests/webtbf/tw4695.pp

+ 1 - 0
.gitattributes

@@ -5948,6 +5948,7 @@ tests/webtbf/tw4619a.pp -text svneol=unset#text/plain
 tests/webtbf/tw4619b.pp svneol=native#text/plain
 tests/webtbf/tw4647.pp svneol=native#text/plain
 tests/webtbf/tw4651.pp svneol=native#text/plain
+tests/webtbf/tw4695.pp svneol=native#text/plain
 tests/webtbf/uw0744.pp svneol=native#text/plain
 tests/webtbf/uw0840a.pp svneol=native#text/plain
 tests/webtbf/uw0840b.pp svneol=native#text/plain

+ 1 - 0
compiler/pstatmnt.pas

@@ -303,6 +303,7 @@ implementation
          consume(_FOR);
 
          hloopvar:=factor(false);
+         valid_for_assignment(hloopvar,true);
 
          { Check loop variable }
          loopvarsym:=nil;

+ 13 - 0
tests/webtbf/tw4695.pp

@@ -0,0 +1,13 @@
+{ %fail }
+{ Source provided for Free Pascal Bug Report 4695 }
+{ Submitted by "Ales Katona" on  2006-01-13 }
+{ e-mail: [email protected] }
+program test;
+
+var
+  i: Integer;
+begin
+  for i:=0 to 5 do
+    for i:=5 downto 0 do
+      Writeln('LOOPY');
+end.