From: Pierre Muller Date: Fri, 26 May 2023 15:09:47 +0000 (+0200) Subject: [PATCH] Fix for sparc64 specific code generation bug report #40252 X-Git-Tag: archive/raspbian/3.2.2+dfsg-32+rpi1^2~2 X-Git-Url: https://dgit.raspbian.org/?a=commitdiff_plain;h=e84d9e793a74c1b2bd36759b1ebc96b5ad707a19;p=fpc.git [PATCH] Fix for sparc64 specific code generation bug report #40252 Gbp-Pq: Name 6-3bb2586269c876856a834fb0d72a09928ff9d16b.patch --- diff --git a/fpcsrc/compiler/sparc64/cpupara.pas b/fpcsrc/compiler/sparc64/cpupara.pas index 453e88e4..840ae4aa 100644 --- a/fpcsrc/compiler/sparc64/cpupara.pas +++ b/fpcsrc/compiler/sparc64/cpupara.pas @@ -67,8 +67,9 @@ implementation is_open_array(def) or is_array_of_const(def) or is_array_constructor(def); + { Fix codegen problem for empty record by always passing by address a zero-sized record } recorddef: - result:=def.size>recsizelimit; + result:=(def.size>recsizelimit) or (def.size=0); variantdef: result:=false; formaldef : diff --git a/fpcsrc/tests/webtbs/tw40252.pp b/fpcsrc/tests/webtbs/tw40252.pp new file mode 100644 index 00000000..aca68f1a --- /dev/null +++ b/fpcsrc/tests/webtbs/tw40252.pp @@ -0,0 +1,25 @@ + +type + TLazLoggerLogEnabled = record end; + +procedure Test(Log : TLazLoggerLogEnabled; const s : string); +begin + writeln('Test: ',s); +end; + +procedure Testv(var Log : TLazLoggerLogEnabled; const s : string); +begin + writeln('Testv: ',s); +end; + +procedure DebuglnStack(LogEnabled: TLazLoggerLogEnabled; const s: string); +begin + Test(LogEnabled, s); + Testv(LogEnabled, s); +end; + +var + LE : TLazLoggerLogEnabled; +begin + DebuglnStack(LE,'Test string'); +end.