Re: [patch] [3/5] Types reference counting [make_function_type-objfile]

Tom Tromey
2009-06-26T17:24:18Z

>>>>> "Ulrich" == Ulrich Weigand <uweigand@de.ibm.com> writes:

Ulrich> Mostly. We still can have the case were TYPE_OBJFILE(A) is NULL but
Ulrich> TYPE_OBJFILE(B) is non-NULL, for example where A is a temporary array
Ulrich> and B the element type.

Ulrich> The way I see the invariant is
Ulrich> If Type A references Type B *and* A is objfile-associated
Ulrich> *then* B must be associated to the same objfile

Suppose we have A as an array type with a NULL objfile, and with
element type B, which has an objfile.

If we have a convenience variable of type A, and the objfile is
deleted, I don't think preserve_values will copy type B. That is
because we only check the value's immediate objfile to decide whether
we need to do a type copy.

Therefore it seems to me that the invariant must be TYPE_OBJFILE(A) ==
TYPE_OBJFILE(B), for all related types A and B.

Tom