[hackers] [scc] Fix eqtype() || Roberto E. Vargas Caballero
commit 79412493b4cd9c428b6335613d9f720b79b3faf8
Author: Roberto E. Vargas Caballero <k0ga_AT_shike2.com>
AuthorDate: Wed Jan 20 15:51:03 2016 +0100
Commit: Roberto E. Vargas Caballero <k0ga_AT_shike2.com>
CommitDate: Wed Jan 20 15:51:03 2016 +0100
Fix eqtype()
Eqtype was not checking that both types had the same op, and it meant
that pointer and array could be compared equal.
diff --git a/cc1/types.c b/cc1/types.c
index 9966ba6..ff7616d 100644
--- a/cc1/types.c
+++ b/cc1/types.c
_AT_@ -521,16 +521,18 @@ eqtype(Type *tp1, Type *tp2)
return 0;
if (tp1 == tp2)
return 1;
+ if (tp1->op != tp2->op)
+ return 0;
switch (tp1->op) {
case ARY:
- if (tp1->op != tp2->op || tp1->n.elem != tp2->n.elem)
+ if (tp1->n.elem != tp2->n.elem)
return 0;
case PTR:
return eqtype(tp1->type, tp2->type);
case UNION:
case STRUCT:
case FTN:
- if (tp1->op != tp2->op || tp1->n.elem != tp2->n.elem)
+ if (tp1->n.elem != tp2->n.elem)
return 0;
p1 = tp1->p.pars, p2 = tp2->p.pars;
for (n = tp1->n.elem; n > 0; --n) {
Received on Wed Jan 20 2016 - 16:02:23 CET
This archive was generated by hypermail 2.3.0
: Wed Jan 20 2016 - 16:12:24 CET