Browse Source

* 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

Sven/Sarah Barth 9 months ago
parent
commit
0430e1bd1a
1 changed files with 7 additions and 2 deletions
  1. 7 2
      compiler/aarch64/cpupara.pas

+ 7 - 2
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,