Browse Source

* don't overwrite register variables when evaluating <=/>= expressions with
smallsets (left is overwritten by an "and", so it cannot be const; mantis
#18013)

git-svn-id: trunk@16400 -

Jonas Maebe 14 years ago
parent
commit
44178f41b6
3 changed files with 17 additions and 1 deletions
  1. 1 0
      .gitattributes
  2. 1 1
      compiler/x86/nx86add.pas
  3. 15 0
      tests/webtbs/tw18013.pp

+ 1 - 0
.gitattributes

@@ -10755,6 +10755,7 @@ tests/webtbs/tw1792a.pp svneol=native#text/plain
 tests/webtbs/tw17945.pp svneol=native#text/pascal
 tests/webtbs/tw17945.pp svneol=native#text/pascal
 tests/webtbs/tw17950.pp svneol=native#text/pascal
 tests/webtbs/tw17950.pp svneol=native#text/pascal
 tests/webtbs/tw1798.pp svneol=native#text/plain
 tests/webtbs/tw1798.pp svneol=native#text/plain
+tests/webtbs/tw18013.pp svneol=native#text/plain
 tests/webtbs/tw1820.pp svneol=native#text/plain
 tests/webtbs/tw1820.pp svneol=native#text/plain
 tests/webtbs/tw1825.pp svneol=native#text/plain
 tests/webtbs/tw1825.pp svneol=native#text/plain
 tests/webtbs/tw1850.pp svneol=native#text/plain
 tests/webtbs/tw1850.pp svneol=native#text/plain

+ 1 - 1
compiler/x86/nx86add.pas

@@ -451,7 +451,7 @@ unit nx86add;
               if (not(nf_swapped in flags) and (nodetype = lten)) or
               if (not(nf_swapped in flags) and (nodetype = lten)) or
                  ((nf_swapped in flags) and (nodetype = gten)) then
                  ((nf_swapped in flags) and (nodetype = gten)) then
                 swapleftright;
                 swapleftright;
-              location_force_reg(current_asmdata.CurrAsmList,left.location,opsize,true);
+              location_force_reg(current_asmdata.CurrAsmList,left.location,opsize,false);
               emit_op_right_left(A_AND,opsize);
               emit_op_right_left(A_AND,opsize);
               op:=A_CMP;
               op:=A_CMP;
               { warning: ugly hack, we need a JE so change the node to equaln }
               { warning: ugly hack, we need a JE so change the node to equaln }

+ 15 - 0
tests/webtbs/tw18013.pp

@@ -0,0 +1,15 @@
+program test;
+
+var
+  wa, ws : set of 1..9;
+begin
+  wa := [1..2];
+  ws := [1..3];
+  if (wa <= ws) and (wa <> ws) then writeln('True') else writeln('False'); 
+  if (wa <= ws) then
+  if (wa <> ws) then writeln('True') else writeln('False'); 
+  if (wa <= ws) then writeln('True') else writeln('False'); 
+  if (wa <> ws) then writeln('True') else writeln('False'); 
+
+end.
+