From 1bb9a3b3d7960980c10a26c4171e07e97235a6e4 Mon Sep 17 00:00:00 2001 From: Jonas Maebe Date: Sat, 20 Aug 2011 20:36:13 +0000 Subject: [PATCH] * fixed generic code for subtracting one set from another if both are in registers, because the left set could be overwritten before its last use git-svn-id: trunk@18792 - --- compiler/ncgadd.pas | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/compiler/ncgadd.pas b/compiler/ncgadd.pas index f4236556bd..45b6a9af25 100644 --- a/compiler/ncgadd.pas +++ b/compiler/ncgadd.pas @@ -303,6 +303,13 @@ interface if (right.location.size<>left.location.size) or (location.size<>left.location.size) then internalerror(2010123001); + { make sure that location.register is different from + left.location.register, since right will overwrite it + and we'll use left afterwards } + if (right.location.loc=LOC_REGISTER) then + location.register:=right.location.register + else + location.register:=cg.getintregister(current_asmdata.CurrAsmList,location.size); { make sure we don't modify left/right.location, because we told force_reg_left_right above that they can be constant } cg.a_op_reg_reg(current_asmdata.CurrAsmList,OP_NOT,location.size,right.location.register,location.register);