فهرست منبع

* 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 -

florian 5 سال پیش
والد
کامیت
fabe4cc067
3فایلهای تغییر یافته به همراه23 افزوده شده و 6 حذف شده
  1. 1 0
      .gitattributes
  2. 4 6
      compiler/ncgcal.pas
  3. 18 0
      tests/webtbs/tw36079.pp

+ 1 - 0
.gitattributes

@@ -17847,6 +17847,7 @@ tests/webtbs/tw35955.pp svneol=native#text/pascal
 tests/webtbs/tw35965.pp svneol=native#text/pascal
 tests/webtbs/tw35982.pp svneol=native#text/pascal
 tests/webtbs/tw36013.pp svneol=native#text/pascal
+tests/webtbs/tw36079.pp svneol=native#text/pascal
 tests/webtbs/tw3612.pp svneol=native#text/plain
 tests/webtbs/tw36156.pp svneol=native#text/plain
 tests/webtbs/tw36157.pp svneol=native#text/plain

+ 4 - 6
compiler/ncgcal.pas

@@ -1054,8 +1054,6 @@ implementation
                    begin
                      reorder_parameters;
                      pushparas;
-                     { free the resources allocated for the parameters }
-                     freeparas;
                    end;
 
                  if callref then
@@ -1091,8 +1089,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);
@@ -1157,8 +1153,6 @@ implementation
                 begin
                   reorder_parameters;
                   pushparas;
-                  { free the resources allocated for the parameters }
-                  freeparas;
                 end;
 
               if callref then
@@ -1186,6 +1180,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.