|
From: | David Mertens |
Subject: | Re: [Tinycc-devel] When does a CType's ref contain a valid pointer? |
Date: | Mon, 27 Jul 2015 11:58:17 -0400 |
Hi,
On Mon, 27 Jul 2015, David Mertens wrote:
> Hello everyone,
>
> While working on symbol table copying, I have run into trouble copying
> type.ref pointers that point to garbage. Suppose we have a type struct
> called "type_to_check". Then I thought the following check would ensure
> that the .ref field was valid:
>
> int btype = type_to_check->type.t & VT_BTYPE;
> if (btype == VT_PTR || btype == VT_STRUCT || btype == VT_FUNC) {
> /* type_to_check.ref is a valid pointer */
No, type_to_check->type.ref should be a valid pointer. Or your btype
computation was wrong and you meant "type_to_check->t & VT_BTYPE". Note
that also VT_ARRAY use the ->ref field.
Ciao,
Michael.
_______________________________________________
Tinycc-devel mailing list
address@hidden
https://lists.nongnu.org/mailman/listinfo/tinycc-devel
[Prev in Thread] | Current Thread | [Next in Thread] |