Forráskód Böngészése

* don't pre-finalize temp nodes that are passed by reference as hidden
function result parameter, because reference counted function results
are not guaranteed to be initialized (we sometimes even pass the,
non-finalized, left-hand side of an assignment as hidden function
result parameter)

git-svn-id: trunk@21955 -

Jonas Maebe 13 éve
szülő
commit
ccbcb36f98
1 módosított fájl, 4 hozzáadás és 2 törlés
  1. 4 2
      compiler/ncgbas.pas

+ 4 - 2
compiler/ncgbas.pas

@@ -405,8 +405,10 @@ interface
                 location_reset_ref(tempinfo^.location,LOC_REFERENCE,def_cgsize(tempinfo^.typedef),0);
                 tg.gethltemptyped(current_asmdata.CurrAsmList,tempinfo^.typedef,tempinfo^.temptype,tempinfo^.location.reference);
                 { the temp could have been used previously either because the memory location was reused or
-                  because we're in a loop }
-                hlcg.g_finalize(current_asmdata.CurrAsmList,tempinfo^.typedef,tempinfo^.location.reference);
+                  because we're in a loop. In case it's used as a function result, that doesn't matter
+                  because it will be finalized when assigned to. }
+                if not(nf_is_funcret in flags) then
+                  hlcg.g_finalize(current_asmdata.CurrAsmList,tempinfo^.typedef,tempinfo^.location.reference);
               end
             else if (ti_may_be_in_reg in tempinfo^.flags) then
               begin