Browse Source

fix type of temps generated for parameters during inlining

peter 20 years ago
parent
commit
e71066495c
1 changed files with 8 additions and 3 deletions
  1. 8 3
      compiler/ncal.pas

+ 8 - 3
compiler/ncal.pas

@@ -2086,16 +2086,18 @@ type
               begin
               begin
                 { create temps for value parameters, function result and also for    }
                 { create temps for value parameters, function result and also for    }
                 { const parameters which are passed by value instead of by reference }
                 { const parameters which are passed by value instead of by reference }
+                { we need to take care that we use the type of the defined parameter and not of the
+                  passed parameter, because these can be different in case of a formaldef (PFV) }
                 if (vo_is_funcret in tparavarsym(para.parasym).varoptions) or
                 if (vo_is_funcret in tparavarsym(para.parasym).varoptions) or
                    (para.parasym.varspez = vs_value) or
                    (para.parasym.varspez = vs_value) or
                    ((para.parasym.varspez = vs_const) and
                    ((para.parasym.varspez = vs_const) and
-                    (not paramanager.push_addr_param(vs_const,para.left.resulttype.def,procdefinition.proccalloption) or
+                    (not paramanager.push_addr_param(vs_const,para.parasym.vartype.def,procdefinition.proccalloption) or
                     { the problem is that we can't take the address of a function result :( }
                     { the problem is that we can't take the address of a function result :( }
                      (node_complexity(para.left) >= NODE_COMPLEXITY_INF))) then
                      (node_complexity(para.left) >= NODE_COMPLEXITY_INF))) then
                   begin
                   begin
                     { in theory, this is always regable, but ncgcall can't }
                     { in theory, this is always regable, but ncgcall can't }
                     { handle it yet in all situations (JM)                 }
                     { handle it yet in all situations (JM)                 }
-                    tempnode := ctempcreatenode.create(para.left.resulttype,para.left.resulttype.def.size,tt_persistent,tparavarsym(para.parasym).varregable <> vr_none);
+                    tempnode := ctempcreatenode.create(para.parasym.vartype,para.parasym.vartype.def.size,tt_persistent,tparavarsym(para.parasym).varregable <> vr_none);
                     addstatement(createstatement,tempnode);
                     addstatement(createstatement,tempnode);
                     { assign the value of the parameter to the temp, except in case of the function result }
                     { assign the value of the parameter to the temp, except in case of the function result }
                     { (in that case, para.left is a block containing the creation of a new temp, while we  }
                     { (in that case, para.left is a block containing the creation of a new temp, while we  }
@@ -2518,7 +2520,10 @@ begin
 end.
 end.
 {
 {
   $Log$
   $Log$
-  Revision 1.281  2005-03-25 22:20:18  peter
+  Revision 1.282  2005-03-28 15:05:17  peter
+  fix type of temps generated for parameters during inlining
+
+  Revision 1.281  2005/03/25 22:20:18  peter
     * add hint when passing an uninitialized variable to a var parameter
     * add hint when passing an uninitialized variable to a var parameter
 
 
   Revision 1.280  2005/03/14 20:18:46  peter
   Revision 1.280  2005/03/14 20:18:46  peter