summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorjonas <jonas@3ad0048d-3df7-0310-abae-a5850022a9f2>2008-01-04 20:51:09 +0000
committerjonas <jonas@3ad0048d-3df7-0310-abae-a5850022a9f2>2008-01-04 20:51:09 +0000
commit0d9a0d6f74599b2da7fdb1c4ca8e7bae145ead61 (patch)
tree82f0406d094ea8923b56b1dac21fc00a22928e54
parent1474bec2549e7cf99745c5dca88d4f444eab14d7 (diff)
downloadfpc-0d9a0d6f74599b2da7fdb1c4ca8e7bae145ead61.tar.gz
* 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: http://svn.freepascal.org/svn/fpc/trunk@9626 3ad0048d-3df7-0310-abae-a5850022a9f2
-rw-r--r--compiler/ncgld.pas8
1 files changed, 6 insertions, 2 deletions
diff --git a/compiler/ncgld.pas b/compiler/ncgld.pas
index f96d509741..627d20c9c8 100644
--- a/compiler/ncgld.pas
+++ b/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