Browse Source

* on i386-win32 when using stdcall calling conventions, records with a size of 1,2 and 4 are returned in al/ax/eax now, resolves #22675

git-svn-id: trunk@22146 -
florian 13 years ago
parent
commit
74d3c8cc57
1 changed files with 9 additions and 5 deletions
  1. 9 5
      compiler/i386/cpupara.pas

+ 9 - 5
compiler/i386/cpupara.pas

@@ -108,11 +108,15 @@ unit cpupara;
               case def.typ of
                 recorddef :
                   begin
-                    { Win32 GCC returns small records in the FUNCTION_RETURN_REG.
-                      For stdcall we follow delphi instead of GCC }
-                    if (calloption in [pocall_cdecl,pocall_cppdecl]) and
-                       (def.size>0) and
-                       (def.size<=8) then
+                    { Win32 GCC returns small records in the FUNCTION_RETURN_REG up to 8 bytes in registers.
+
+                      For stdcall and register we follow delphi instead of GCC which returns
+                      only records of a size of 1,2 or 4 bytes in FUNCTION_RETURN_REG }
+                    if ((calloption in [pocall_stdcall,pocall_register]) and
+                        (def.size in [1,2,4])) or
+                       ((calloption in [pocall_cdecl,pocall_cppdecl]) and
+                        (def.size>0) and
+                        (def.size<=8)) then
                      begin
                        result:=false;
                        exit;