From e1226b074f7d7e52c1fc0876b9cd88ec18ef2e9f Mon Sep 17 00:00:00 2001 From: Jonas Maebe Date: Fri, 28 Jul 2000 13:28:25 +0000 Subject: [PATCH] * fixed bug in secondshlshr where ecx was released too soon in some cases causing a combination of -Or and -dnewoptimizations to generate wrong code (merged from fixes branch and since in 1.1 -dnewoptimizations has been released, it always generated wrong code here when using -O2 or higher) --- compiler/cg386mat.pas | 16 +++++++++++++--- 1 file changed, 13 insertions(+), 3 deletions(-) diff --git a/compiler/cg386mat.pas b/compiler/cg386mat.pas index fa62660f6a..074e888f03 100644 --- a/compiler/cg386mat.pas +++ b/compiler/cg386mat.pas @@ -472,7 +472,8 @@ implementation emit_reg_reg(A_MOV,S_L,hregister2,R_ECX); end; - ungetregister32(hregister2); + if hregister2 <> R_ECX then + ungetregister32(hregister2); { the damned shift instructions work only til a count of 32 } { so we've to do some tricks here } @@ -532,7 +533,8 @@ implementation { maybe put ECX back } if popecx then - emit_reg(A_POP,S_L,R_ECX); + emit_reg(A_POP,S_L,R_ECX) + else ungetregister32(R_ECX); p^.location.registerlow:=hregisterlow; p^.location.registerhigh:=hregisterhigh; @@ -986,7 +988,15 @@ implementation end. { $Log$ - Revision 1.3 2000-07-14 05:11:48 michael + Revision 1.4 2000-07-28 13:28:25 jonas + * fixed bug in secondshlshr where ecx was released too soon in some + cases causing a combination of -Or and -dnewoptimizations to generate + wrong code + (merged from fixes branch and since in 1.1 -dnewoptimizations has + been released, it always generated wrong code here when using -O2 or + higher) + + Revision 1.3 2000/07/14 05:11:48 michael + Patch to 1.1 Revision 1.2 2000/07/13 11:32:35 michael