瀏覽代碼

* use currpara.paraloc[calleeside].def instead of currpara.vardef when copying parameters to local registers in ncgutil. this mimics hlcgobj behavior and fixes parameters passed by reference to be allocated into intregs on m68k. among others, this has a big impact on OOP code, because of self, for example

git-svn-id: trunk@33707 -
Károly Balogh 9 年之前
父節點
當前提交
b6242d14ed
共有 1 個文件被更改,包括 3 次插入1 次删除
  1. 3 1
      compiler/ncgutil.pas

+ 3 - 1
compiler/ncgutil.pas

@@ -1308,7 +1308,9 @@ implementation
         for i:=0 to current_procinfo.procdef.paras.count-1 do
           begin
             currpara:=tparavarsym(current_procinfo.procdef.paras[i]);
-            gen_load_cgpara_loc(list,currpara.vardef,currpara.paraloc[calleeside],currpara.initialloc,paramanager.param_use_paraloc(currpara.paraloc[calleeside]));
+            { don't use currpara.vardef, as this will be wrong in case of
+              call-by-reference parameters (it won't contain the pointerdef) }
+            gen_load_cgpara_loc(list,currpara.paraloc[calleeside].def,currpara.paraloc[calleeside],currpara.initialloc,paramanager.param_use_paraloc(currpara.paraloc[calleeside]));
             { gen_load_cgpara_loc() already allocated the initialloc
               -> don't allocate again }
             if currpara.initialloc.loc in [LOC_CREGISTER,LOC_CFPUREGISTER,LOC_CMMREGISTER] then