Prechádzať zdrojové kódy

* take of life of tlabelnode.left, the test does not test this however because I'am not aware of any example to force a left node for a label

git-svn-id: trunk@26082 -
florian 11 rokov pred
rodič
commit
92508a9801
3 zmenil súbory, kde vykonal 27 pridanie a 2 odobranie
  1. 1 0
      .gitattributes
  2. 12 2
      compiler/optdfa.pas
  3. 14 0
      tests/test/opt/tdfa3.pp

+ 1 - 0
.gitattributes

@@ -10780,6 +10780,7 @@ tests/test/opt/tcse4.pp svneol=native#text/pascal
 tests/test/opt/tcse5.pp svneol=native#text/pascal
 tests/test/opt/tdfa1.pp svneol=native#text/pascal
 tests/test/opt/tdfa2.pp svneol=native#text/pascal
+tests/test/opt/tdfa3.pp svneol=native#text/pascal
 tests/test/opt/tgotoreg.pp svneol=native#text/plain
 tests/test/opt/treg1.pp svneol=native#text/plain
 tests/test/opt/treg2.pp svneol=native#text/plain

+ 12 - 2
compiler/optdfa.pas

@@ -538,13 +538,23 @@ unit optdfa;
                 calclife(node);
               end;
 
+            labeln:
+              begin
+                calclife(node);
+
+                if assigned(tlabelnode(node).left) then
+                  begin
+                    l:=node.optinfo^.life;
+                    DFASetIncludeSet(l,tlabelnode(node).optinfo^.life);
+                    UpdateLifeInfo(node,l);
+                  end;
+              end;
             tempcreaten,
             tempdeleten,
             nothingn,
             continuen,
             goton,
-            breakn,
-            labeln:
+            breakn:
               begin
                 calclife(node);
               end;

+ 14 - 0
tests/test/opt/tdfa3.pp

@@ -0,0 +1,14 @@
+{ %OPT=-Oodfa -Sew -vw -Sg }
+{ %fail }
+{ %norun  }
+var
+  i : longint;
+label
+  l;
+begin
+  goto l;
+  i:=1;
+  l:
+  writeln(i);
+end.
+