Browse Source

Fix folding of (comparison x x).

Mike Pall 15 years ago
parent
commit
a25a717089
1 changed files with 1 additions and 1 deletions
  1. 1 1
      src/lj_opt_fold.c

+ 1 - 1
src/lj_opt_fold.c

@@ -1020,7 +1020,7 @@ LJFOLDF(comm_comp)
 {
 {
   /* For non-numbers only: x <=> x ==> drop; x <> x ==> fail */
   /* For non-numbers only: x <=> x ==> drop; x <> x ==> fail */
   if (fins->op1 == fins->op2 && !irt_isnum(fins->t))
   if (fins->op1 == fins->op2 && !irt_isnum(fins->t))
-    return CONDFOLD(fins->o & 1);
+    return CONDFOLD((fins->o ^ (fins->o >> 1)) & 1);
   if (fins->op1 < fins->op2) {  /* Move lower ref to the right. */
   if (fins->op1 < fins->op2) {  /* Move lower ref to the right. */
     IRRef1 tmp = fins->op1;
     IRRef1 tmp = fins->op1;
     fins->op1 = fins->op2;
     fins->op1 = fins->op2;