From 74d3c8cc573505c649134d23900ddab5aeefc8d5 Mon Sep 17 00:00:00 2001 From: florian Date: Mon, 20 Aug 2012 16:57:53 +0000 Subject: [PATCH] * 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 - --- compiler/i386/cpupara.pas | 14 +++++++++----- 1 file changed, 9 insertions(+), 5 deletions(-) diff --git a/compiler/i386/cpupara.pas b/compiler/i386/cpupara.pas index 395d3b6c4a..0a61dacad8 100644 --- a/compiler/i386/cpupara.pas +++ b/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;