[hackers] [scc] Fix type comparision || Roberto E. Vargas Caballero

From: <git_AT_suckless.org>
Date: Thu, 13 Aug 2015 20:02:11 +0200 (CEST)

commit 9b1eafb87ca51b32030a2a53bed3f2170bf2f936
Author: Roberto E. Vargas Caballero <k0ga_AT_shike2.com>
AuthorDate: Thu Aug 13 16:14:55 2015 +0200
Commit: Roberto E. Vargas Caballero <k0ga_AT_shike2.com>
CommitDate: Thu Aug 13 16:14:55 2015 +0200

    Fix type comparision
    
    Field n.elem cannot be used until we know that it is a field used
    in the type, so we have to check first the op of the type.
    This problem was generating errors in pointer type comparision.

diff --git a/cc1/types.c b/cc1/types.c
index f1c57ed..05aac8a 100644
--- a/cc1/types.c
+++ b/cc1/types.c
_AT_@ -337,15 +337,17 @@ eqtype(Type *tp1, Type *tp2)
                 return 0;
         if (tp1 == tp2)
                 return 1;
- if (tp1->op != tp2->op || tp1->n.elem != tp2->n.elem)
- return 0;
         switch (tp1->op) {
         case ARY:
+ if (tp1->op != tp2->op || 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)
+ return 0;
                 p1 = tp1->pars, p2 = tp2->pars;
                 for (n = tp1->n.elem; n > 0; --n) {
                         if (!eqtype(*p1++, *p2++))
Received on Thu Aug 13 2015 - 20:02:11 CEST

This archive was generated by hypermail 2.3.0 : Thu Aug 13 2015 - 20:12:22 CEST