Browse Source

Short version of the mips code genration bug

Pierre Muller 2 years ago
parent
commit
dce70b3b70
2 changed files with 17 additions and 7 deletions
  1. 15 5
      compiler/ncal.pas
  2. 2 2
      compiler/ncgcal.pas

+ 15 - 5
compiler/ncal.pas

@@ -4364,15 +4364,25 @@ implementation
     procedure tcallnode.check_stack_parameters;
       var
         hp : tcallparanode;
+       loc : pcgparalocation;
       begin
         hp:=tcallparanode(left);
         while assigned(hp) do
           begin
-             if assigned(hp.parasym) and
-                assigned(hp.parasym.paraloc[callerside].location) and
-               (hp.parasym.paraloc[callerside].location^.loc=LOC_REFERENCE) then
-               include(current_procinfo.flags,pi_has_stackparameter);
-             hp:=tcallparanode(hp.right);
+            if assigned(hp.parasym) then
+              begin
+                loc:=hp.parasym.paraloc[callerside].location;
+                while assigned(loc) do
+                  begin
+                    if loc^.loc=LOC_REFERENCE then
+                      begin
+                        include(current_procinfo.flags,pi_has_stackparameter);
+                        exit;
+                       end;
+                      loc:=loc^.next;
+                  end;
+              end;
+            hp:=tcallparanode(hp.right);
           end;
       end;
 

+ 2 - 2
compiler/ncgcal.pas

@@ -793,7 +793,7 @@ implementation
                  }
                  paramanager.freecgpara(current_asmdata.CurrAsmList,ppn.tempcgpara);
                  tmpparaloc:=ppn.tempcgpara.location;
-                 sizeleft:=ppn.tempcgpara.intsize;
+                 sizeleft:=ppn.parasym.paraloc[callerside].intsize;
                  calleralignment:=ppn.parasym.paraloc[callerside].alignment;
                  tmpalignment:=ppn.tempcgpara.alignment;
                  if (tmpalignment=0) or
@@ -857,7 +857,7 @@ implementation
                                     reference_reset_base(htempref,tmpparaloc^.reference.index,tmpparaloc^.reference.offset,ctempposinvalid,tmpalignment,[]);
                                     { use concatcopy, because it can also be a float which fails when
                                       load_ref_ref is used }
-                                    if (ppn.tempcgpara.size <> OS_NO) then
+                                    if (tmpparaloc^.size <> OS_NO) then
                                       cg.g_concatcopy(current_asmdata.CurrAsmList,htempref,href,tcgsize2size[tmpparaloc^.size])
                                     else
                                       cg.g_concatcopy(current_asmdata.CurrAsmList,htempref,href,sizeleft)