tinycc-devel
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: [Tinycc-devel] When does a CType's ref contain a valid pointer?


From: Michael Matz
Subject: Re: [Tinycc-devel] When does a CType's ref contain a valid pointer?
Date: Mon, 27 Jul 2015 17:52:04 +0200 (CEST)
User-agent: Alpine 2.20 (LSU 67 2015-01-07)

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.



reply via email to

[Prev in Thread] Current Thread [Next in Thread]