From 0430e1bd1ae4c64aacb78fa6a8f08dacc108507f Mon Sep 17 00:00:00 2001 From: Sven/Sarah Barth Date: Fri, 8 Nov 2024 16:44:26 +0100 Subject: [PATCH] * pass all const record parameters on aarch64-win64 as references due to the habit of passing records as pointers by using the const modifier in the Windows unit --- compiler/aarch64/cpupara.pas | 9 +++++++-- 1 file changed, 7 insertions(+), 2 deletions(-) diff --git a/compiler/aarch64/cpupara.pas b/compiler/aarch64/cpupara.pas index 74879343bb..ffe77e4bd0 100644 --- a/compiler/aarch64/cpupara.pas +++ b/compiler/aarch64/cpupara.pas @@ -179,10 +179,15 @@ unit cpupara; { ABI: any composite > 16 bytes that not a hfa/hva Special case: MWPascal, which passes all const parameters by reference for compatibility reasons - } + Special case 2: on Windows we need to pass all const records by + reference due to the Windows unit (ab)using const to pass + pointer parameters } result:= ((varspez=vs_const) and - (calloption=pocall_mwpascal)) or + ( + (calloption=pocall_mwpascal) or + (target_info.system=system_aarch64_win64) + )) or (not is_hfa(def,hfabasedef) and (def.size>16)); variantdef,