Browse Source

* fixed crashing bug to due previous changes

Jonas Maebe 24 years ago
parent
commit
7725beb1e3
1 changed files with 21 additions and 6 deletions
  1. 21 6
      compiler/i386/csopt386.pas

+ 21 - 6
compiler/i386/csopt386.pas

@@ -1627,10 +1627,13 @@ End;
 function removeInstructs(asmL: TAAsmoutput; first, last: Tai): boolean;
 function removeInstructs(asmL: TAAsmoutput; first, last: Tai): boolean;
 { Removes the marked instructions and disposes the PTaiProps of the other }
 { Removes the marked instructions and disposes the PTaiProps of the other }
 { instructions                                                            }
 { instructions                                                            }
-Var p, hp1: Tai;
+Var
+  p, hp1: Tai;
+  nopropinfolevel: longint;
 begin
 begin
   removeInstructs := false;
   removeInstructs := false;
   p := First;
   p := First;
+  nopropinfolevel := 0;
   While (p <> Last) Do
   While (p <> Last) Do
     Begin
     Begin
       If (p.typ = ait_marker) and
       If (p.typ = ait_marker) and
@@ -1639,21 +1642,30 @@ begin
           hp1 := Tai(p.next);
           hp1 := Tai(p.next);
           asmL.remove(p);
           asmL.remove(p);
           p.free;
           p.free;
-          while not((hp1.typ = ait_marker) and
-                    (Tai_marker(p).kind = noPropInfoEnd)) do
+          nopropinfolevel := 1;
+          while (nopropinfolevel <> 0) do
             begin
             begin
               p := Tai(hp1.next);
               p := Tai(hp1.next);
 {$ifndef noinstremove}
 {$ifndef noinstremove}
               { allocregbetween can insert new ait_regalloc objects }
               { allocregbetween can insert new ait_regalloc objects }
               { without optinfo                                     }
               { without optinfo                                     }
-              if assigned(hp1.optinfo) then
+              if (hp1.typ = ait_marker) then
+                begin
+                  case Tai_marker(hp1).kind of
+                    { they can be nested! }
+                    noPropInfoStart: inc(nopropinfolevel);
+                    noPropInfoEnd: dec(nopropinfolevel);
+                  end;
+                  asmL.remove(hp1);
+                  hp1.free;
+                end
+              else if assigned(hp1.optinfo) then
                 if pTaiprop(hp1.optinfo)^.canBeRemoved then
                 if pTaiprop(hp1.optinfo)^.canBeRemoved then
                   begin
                   begin
                     dispose(pTaiprop(hp1.optinfo));
                     dispose(pTaiprop(hp1.optinfo));
                     hp1.optinfo := nil;
                     hp1.optinfo := nil;
                     asmL.remove(hp1);
                     asmL.remove(hp1);
                     hp1.free;
                     hp1.free;
-                    hp1 := p;
                   end
                   end
                 else
                 else
 {$endif noinstremove}
 {$endif noinstremove}
@@ -1702,7 +1714,10 @@ End.
 
 
 {
 {
   $Log$
   $Log$
-  Revision 1.11  2001-01-06 23:35:05  jonas
+  Revision 1.12  2001-01-07 15:51:17  jonas
+    * fixed crashing bug to due previous changes
+
+  Revision 1.11  2001/01/06 23:35:05  jonas
     * fixed webbug 1323
     * fixed webbug 1323
 
 
   Revision 1.10  2000/12/25 00:07:31  peter
   Revision 1.10  2000/12/25 00:07:31  peter