Browse Source

* properly deal with reference temps in tcgtempdeletenode.pass_generate_code

git-svn-id: branches/jvmbackend@18665 -
Jonas Maebe 14 năm trước cách đây
mục cha
commit
b556c05b1a
1 tập tin đã thay đổi với 15 bổ sung0 xóa
  1. 15 0
      compiler/ncgbas.pas

+ 15 - 0
compiler/ncgbas.pas

@@ -501,6 +501,21 @@ interface
 
     procedure tcgtempdeletenode.pass_generate_code;
       begin
+        if ti_reference in tempinfo^.flags then
+          begin
+            { release_to_normal means that the temp will be freed the next
+              time it's used. However, reference temps reference some other
+              location that is not managed by this temp and hence cannot be
+              freed }
+            if release_to_normal then
+              internalerror(2011052205);
+            { so we only mark this temp location as "no longer valid" when
+              it's deleted (ttempdeletenodes are also used during getcopy, so
+              we really do need one) }
+            exclude(tempinfo^.flags,ti_valid);
+            exit;
+          end;
+
         location_reset(location,LOC_VOID,OS_NO);
 
         case tempinfo^.location.loc of