summaryrefslogtreecommitdiff
path: root/compiler/ncgutil.pas
diff options
context:
space:
mode:
authorjonas <jonas@3ad0048d-3df7-0310-abae-a5850022a9f2>2014-02-02 09:09:44 +0000
committerjonas <jonas@3ad0048d-3df7-0310-abae-a5850022a9f2>2014-02-02 09:09:44 +0000
commit5b09091e36fa99a703d01745bb88cdbdcb835efb (patch)
treecde5bea40d2b59209f07281ac65d4ed4f0f374f9 /compiler/ncgutil.pas
parent622f74e9170b9e1b84fa8eae42321f4020111560 (diff)
downloadfpc-5b09091e36fa99a703d01745bb88cdbdcb835efb.tar.gz
* the function result of constructors always is self, always is valid and is
not stored in procdef.funcretsym -> fix check so that SSA is not performed on it in constructors when exit is used git-svn-id: http://svn.freepascal.org/svn/fpc/trunk@26650 3ad0048d-3df7-0310-abae-a5850022a9f2
Diffstat (limited to 'compiler/ncgutil.pas')
-rw-r--r--compiler/ncgutil.pas12
1 files changed, 7 insertions, 5 deletions
diff --git a/compiler/ncgutil.pas b/compiler/ncgutil.pas
index 30f16d0513..db028f7eda 100644
--- a/compiler/ncgutil.pas
+++ b/compiler/ncgutil.pas
@@ -1945,13 +1945,15 @@ implementation
exit;
end;
- if not is_void(current_procinfo.procdef.returndef) and
+ { self is implicitly returned from constructors, even if there are no
+ references to it; additionally, funcretsym is not set for constructor
+ procdefs }
+ if (current_procinfo.procdef.proctypeoption=potype_constructor) then
+ rr.ressym:=tsym(current_procinfo.procdef.parast.Find('self'))
+ else if not is_void(current_procinfo.procdef.returndef) and
assigned(current_procinfo.procdef.funcretsym) and
(tabstractvarsym(current_procinfo.procdef.funcretsym).refs <> 0) then
- if (current_procinfo.procdef.proctypeoption=potype_constructor) then
- rr.ressym:=tsym(current_procinfo.procdef.parast.Find('self'))
- else
- rr.ressym:=current_procinfo.procdef.funcretsym;
+ rr.ressym:=current_procinfo.procdef.funcretsym;
if not foreachnodestatic(n,@doreplace,@rr) then
exit;