Browse Source

* initialise for-loop variables before the loop
o the intiialization code of a for-loop used to do that, but no longer
does so since their automatic transformation to a while-loop. Even
though the code did not read the value of the for-loop variable
in case the loop was not entered, the JVM's verifier is not
sophisticated enough to be able to detect that (it's protected by
a boolean set in the loop)

git-svn-id: trunk@34858 -

Jonas Maebe 8 years ago
parent
commit
1ac51d5cd1
2 changed files with 2 additions and 0 deletions
  1. 1 0
      rtl/java/justrings.inc
  2. 1 0
      rtl/jvm/jvm.inc

+ 1 - 0
rtl/java/justrings.inc

@@ -384,6 +384,7 @@ begin
   if (zerobased) then
   if (zerobased) then
     begin
     begin
       foundnull:=false;
       foundnull:=false;
+      i:=0;
       for i:=low(arr) to high(arr) do
       for i:=low(arr) to high(arr) do
         if arr[i]=#0 then
         if arr[i]=#0 then
           begin
           begin

+ 1 - 0
rtl/jvm/jvm.inc

@@ -388,6 +388,7 @@ begin
   if zerobased then
   if zerobased then
     begin
     begin
       foundnull:=false;
       foundnull:=false;
+      index:=0;
       for index:=low(arr) to l-1 do
       for index:=low(arr) to l-1 do
         if arr[index]=#0 then
         if arr[index]=#0 then
           begin
           begin