2
0
Эх сурвалжийг харах

* fixed internalerror in case the from-value of a for-loop has loc_jump
(mantis #15750)

git-svn-id: trunk@15071 -

Jonas Maebe 15 жил өмнө
parent
commit
d8a902b4c4

+ 1 - 0
.gitattributes

@@ -10315,6 +10315,7 @@ tests/webtbs/tw15694.pp svneol=native#text/plain
 tests/webtbs/tw15727a.pp svneol=native#text/plain
 tests/webtbs/tw15728.pp svneol=native#text/plain
 tests/webtbs/tw1573.pp svneol=native#text/plain
+tests/webtbs/tw15750.pp svneol=native#text/plain
 tests/webtbs/tw15777a.pp svneol=native#text/plain
 tests/webtbs/tw15777c.pp svneol=native#text/plain
 tests/webtbs/tw15777d.pp svneol=native#text/plain

+ 15 - 0
compiler/ncgflw.pas

@@ -490,7 +490,22 @@ implementation
          cg.executionweight:=oldexecutionweight;
 
          { load from value }
+         isjump:=(right.expectloc=LOC_JUMP);
+         if isjump then
+           begin
+              otl:=current_procinfo.CurrTrueLabel;
+              current_asmdata.getjumplabel(current_procinfo.CurrTrueLabel);
+              ofl:=current_procinfo.CurrFalseLabel;
+              current_asmdata.getjumplabel(current_procinfo.CurrFalseLabel);
+           end;
          secondpass(right);
+         if right.location.loc in [LOC_FLAGS,LOC_JUMP] then
+           location_force_reg(current_asmdata.CurrAsmList,right.location,def_cgsize(right.resultdef),false);
+         if isjump then
+           begin
+             current_procinfo.CurrTrueLabel:=otl;
+             current_procinfo.CurrFalseLabel:=ofl;
+           end;
 
          maybechangeloadnodereg(current_asmdata.CurrAsmList,left,false);
          oldflowcontrol:=flowcontrol;

+ 16 - 0
tests/webtbs/tw15750.pp

@@ -0,0 +1,16 @@
+program boolloop;
+var
+  i: longint;
+  a, b: boolean;
+begin
+  a:=true;
+  i:=0;
+  for b:=not a to true do
+    begin
+      inc(i);
+      writeln('now b is ',b);
+    end;
+  if i<>2 then
+    halt(1);
+end.
+