From a85846cc803508728bef56f1dae1ab145775384a Mon Sep 17 00:00:00 2001 From: Stephen Heumann Date: Wed, 8 Jun 2022 20:03:14 -0500 Subject: [PATCH] Fix codegen bug with pc_bno in some cases with a 64-bit right operand. The desired location for the quad result was not saved, so it could be overwritten when generating code for the left operand. This could result in incorrect code that might trash the stack. Here is an example affected by this: #pragma optimize 1 int main(void) { long long a, b=2; char c = (a=1,b); } --- Gen.pas | 3 +++ 1 file changed, 3 insertions(+) diff --git a/Gen.pas b/Gen.pas index 0884a48..6a3e7bc 100644 --- a/Gen.pas +++ b/Gen.pas @@ -5444,11 +5444,14 @@ procedure GenTree {op: icptr}; var lLong: longType; {requested address type} + lQuad: quadType; begin {GenBno} lLong := gLong; + lQuad := gQuad; GenTree(op^.left); gLong := lLong; + gQuad := lQuad; GenTree(op^.right); end; {GenBno}