ref: 137b08b71982b6c82921b9ece97240da4890bf23
parent: 433606f675efdaa466b7e9ab8adb257999af5ae6
author: Ori Bernstein <ori@eigenstate.org>
date: Sun Aug 13 17:21:53 EDT 2017
Types are also equal with flipflopping. If we have types a -> b -> ptr -> a, and b -> a -> ptr -> b, there are cases where the two types can end up on different branches, so we end up flipflopping between avisited and bvisited containing the type we want.
--- a/parse/type.c
+++ b/parse/type.c
@@ -763,6 +763,7 @@
tyeq_rec(Type *a, Type *b, Bitset *avisited, Bitset *bvisited, int search)
{
Type *x, *y;
+ int atid, btid;
size_t i;
int ret;
@@ -786,9 +787,13 @@
if (bshas(avisited, a->tid) && bshas(bvisited, b->tid))
return 1;
+ if (bshas(bvisited, a->tid) && bshas(avisited, b->tid))
+ return 1;
bsput(avisited, a->tid);
bsput(bvisited, b->tid);
+ atid = a->tid;
+ btid = b->tid;
ret = 1;
switch (a->type) {