From ad31ecfcae1aaf2434b0b036b27f92d1a877ddeb Mon Sep 17 00:00:00 2001 From: Stephen Heumann Date: Thu, 13 Jul 2017 23:39:51 -0500 Subject: [PATCH] Fix bug where 32-bit addition and subtraction results are not saved in some cases. This could happen in certain cases where the destination is not considered "simple" (e.g. because it is a local array location that does not fit in the direct page). The following program demonstrates the problem: #pragma optimize 1 int main(void) { long temp1 = 1, temp2 = 2, A[64]; long B[2] = {0}; B[1] = temp1 + temp2; return B[1]; /* should return 3 */ } --- Gen.pas | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Gen.pas b/Gen.pas index 111d244..d1c90ac 100644 --- a/Gen.pas +++ b/Gen.pas @@ -609,7 +609,7 @@ else begin DoOp(0, m_sta_abs, m_sta_dir, save, 2); end; {else} end {if} - else if Simple(op^.right) then begin + else if (save = nil) and Simple(op^.right) then begin gLong.preference := gLong.preference & A_X; GenTree(op^.left); GenImplied(clc);