* only free the temp holding the function result after we've loaded it into

the function return register (so we won't load from an already freed
    temp once we emit lifetime info for temps on LLVM)

git-svn-id: trunk@40501 -
This commit is contained in:
Jonas Maebe 2018-12-08 15:31:48 +00:00
parent 14f3676b2a
commit 3b7efb5123
2 changed files with 8 additions and 2 deletions

View File

@ -5216,7 +5216,9 @@ implementation
gen_load_loc_function_result(list,retdef,ressym.localloc);
end
else
gen_load_uninitialized_function_result(list,current_procinfo.procdef,retdef,current_procinfo.procdef.funcretloc[calleeside])
gen_load_uninitialized_function_result(list,current_procinfo.procdef,retdef,current_procinfo.procdef.funcretloc[calleeside]);
if ressym.localloc.loc=LOC_REFERENCE then
tg.UnGetLocal(list,ressym.localloc.reference);
end;
procedure thlcgobj.gen_stack_check_size_para(list: TAsmList);

View File

@ -1816,7 +1816,11 @@ implementation
cg.a_reg_sync(list,localloc.register);
LOC_REFERENCE :
begin
if typ in [localvarsym,paravarsym] then
{ can't free the result, because we load it after
this call into the function result location
(gets freed in thlcgobj.gen_load_return_value() }
if (typ in [localvarsym,paravarsym]) and
(([vo_is_funcret,vo_is_result]*varoptions)=[]) then
tg.Ungetlocal(list,localloc.reference);
end;
end;