ref: 4deece51bfadf521d8509a1bb62531f9937719ab
parent: 753a0f5c2d7a5f6538a9ecc9b93b89ada78459d2
author: Roberto E. Vargas Caballero <[email protected]>
date: Tue Apr 22 12:22:32 EDT 2014
Fix compare() A comparision has always a integer type, but the operation done in the Node may not be a integer operation. The node of the type also help in order to know what version of the operator must be done, so in this case we have to put the type of the operands, and let that eval() convert the Node type to integer where it is necessary.
--- a/expr.c
+++ b/expr.c
@@ -210,6 +210,13 @@
return bincode(op, np1->type, np1, np2);
}
+/*
+ * FIXME:
+ * Pointers to the same basic type after removing type qualifiers
+ * can be compared. It means that utype pointer must be a field
+ * of the type, not of the Node, because in other case is
+ * hard doing this check
+ */
static Node *
pcompare(char op, Node *np1, Node *np2)
{
@@ -222,7 +229,7 @@
"comparision between different pointer types");
}
- return bincode(op, inttype, np1, np2);
+ return bincode(op, np1->type, np1, np2);
}
static Node *