ref: 1fd69c115bb5155d7dca44242d9c331d122786a4
parent: f78f068b7f726cab481c4c95facda19f4efa8ba5
author: Roberto E. Vargas Caballero <[email protected]>
date: Mon Aug 10 19:15:53 EDT 2015
Fix eqtype() bug Number of elements in functions can be negative (the void case).
--- a/cc1/types.c
+++ b/cc1/types.c
@@ -330,9 +330,11 @@
bool
eqtype(Type *tp1, Type *tp2)
{
- unsigned n;
+ int n;
Type **p1, **p2;
+ if (!tp1 || !tp2)
+ return 0;
if (tp1 == tp2)
return 1;
if (tp1->op != tp2->op || tp1->n.elem != tp2->n.elem)
@@ -345,7 +347,7 @@
case STRUCT:
case FTN:
p1 = tp1->pars, p2 = tp2->pars;
- for (n = tp1->n.elem; n != 0; --n) {
+ for (n = tp1->n.elem; n > 0; --n) {
if (!eqtype(*p1++, *p2++))
return 0;
}