[hackers] [scc] [cc1] Fix conmutative() with == and != || Roberto E. Vargas Caballero

From: <git_AT_suckless.org>
Date: Mon, 29 Aug 2016 08:41:26 +0200 (CEST)

commit 73710f9011f6e6dd2bdc34bacb4bd703af826782
Author: Roberto E. Vargas Caballero <k0ga_AT_shike2.com>
AuthorDate: Mon Aug 29 08:36:18 2016 +0200
Commit: Roberto E. Vargas Caballero <k0ga_AT_shike2.com>
CommitDate: Mon Aug 29 08:36:18 2016 +0200

    [cc1] Fix conmutative() with == and !=
    
    Equality operators are full conmutative, so it is
    not needed to negate the operator when we apply
    the conmutative rule.

diff --git a/cc1/fold.c b/cc1/fold.c
index f2e5306..37cca42 100644
--- a/cc1/fold.c
+++ b/cc1/fold.c
_AT_@ -365,9 +365,9 @@ commutative(int *op, Node **lp, Node **rp)
         case OGT:
         case OGE:
         case OLE:
+ *op = negop(*op);
         case OEQ:
         case ONE:
- *op = negop(*op);
         case OADD:
         case OMUL:
         case OBAND:
diff --git a/cc1/tests/test056.c b/cc1/tests/test056.c
index 5750a08..029f524 100644
--- a/cc1/tests/test056.c
+++ b/cc1/tests/test056.c
_AT_@ -27,7 +27,7 @@ G11 V10 "m (
 G13 I F "main
 {
 \
- h G9 M7 .V6 'P #P2 +P _AT_K gI gN #N0 !I
+ h G9 M7 .V6 'P #P2 +P _AT_K gI gN #N0 =I
 }
 */
 
Received on Mon Aug 29 2016 - 08:41:26 CEST

This archive was generated by hypermail 2.3.0 : Mon Aug 29 2016 - 08:48:14 CEST