Procházet zdrojové kódy

* don't change the temp location of types which needs to be
initialised/finalised, because the init/final generation code
happens after pass 2 using plain nodes and therefore needs the
original locations intact

git-svn-id: trunk@9626 -

Jonas Maebe před 17 roky
rodič
revize
e3d82f1953
1 změnil soubory, kde provedl 6 přidání a 2 odebrání
  1. 6 2
      compiler/ncgld.pas

+ 6 - 2
compiler/ncgld.pas

@@ -135,13 +135,17 @@ implementation
       begin
         result := false;
 
-           { only do for -O2 or higher (breaks debugging since }
-           { variables move to different memory locations)     }
+        { only do for -O2 or higher (breaks debugging since }
+        { variables move to different memory locations)     }
         if not(cs_opt_level2 in current_settings.optimizerswitches) or
            { must be a copy to a memory location ... }
            (n.location.loc <> LOC_REFERENCE) or
            { not inside a control flow statement and no goto's in sight }
            ([fc_inflowcontrol,fc_gotolabel] * flowcontrol <> []) or
+           { not for refcounted types, because those locations are   }
+           { still used later on in initialisation/finalisation code }
+           (not(is_class(n.resultdef)) and
+            n.resultdef.needs_inittable) or
            { source and destination are temps (= not global variables) }
            not tg.istemp(n.location.reference) or
            not tg.istemp(newref) or