2
0
Эх сурвалжийг харах

* patch by Christo Crause: reg. allocation information if non-volatile registers

    are used for parameter passing as it is might happen on avr, resolves #36079

git-svn-id: trunk@43390 -
(cherry picked from commit fabe4cc0676679fde2b8d888dd81b902eed4b3be)

# Conflicts:
#	.gitattributes
florian 5 жил өмнө
parent
commit
201a89504e

+ 4 - 6
compiler/ncgcal.pas

@@ -1048,8 +1048,6 @@ implementation
                    begin
                      reorder_parameters;
                      pushparas;
-                     { free the resources allocated for the parameters }
-                     freeparas;
                    end;
 
                  if callref then
@@ -1085,8 +1083,6 @@ implementation
                     begin
                       reorder_parameters;
                       pushparas;
-                      { free the resources allocated for the parameters }
-                      freeparas;
                     end;
 
                   cg.alloccpuregisters(current_asmdata.CurrAsmList,R_INTREGISTER,regs_to_save_int);
@@ -1146,8 +1142,6 @@ implementation
                 begin
                   reorder_parameters;
                   pushparas;
-                  { free the resources allocated for the parameters }
-                  freeparas;
                 end;
 
               if callref then
@@ -1175,6 +1169,10 @@ implementation
               extra_post_call_code;
            end;
 
+         { free the resources allocated for the parameters }
+         if assigned(left) then
+           freeparas;
+
          { Need to remove the parameters from the stack? }
          if procdefinition.proccalloption in clearstack_pocalls then
            begin

+ 18 - 0
tests/webtbs/tw36079.pp

@@ -0,0 +1,18 @@
+{ %OPT=-O- -O1 }
+program tshlshr;
+
+procedure test(value, required: int64);
+begin
+  if value <> required then
+    halt(1)
+  else
+    halt(0);
+end;
+
+var
+ longres : longint;
+
+begin
+   longres := 32768;
+   test(longres, 32768);
+end.