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: 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

Hey Michael,

You are right about my type, I meant to say "int btype = type_to_check.t & VT_BTYPE;"

Thanks for the confirmation, I'll start digging around elsewhere in my code.

David

On Mon, Jul 27, 2015 at 11:52 AM, Michael Matz <address@hidden> wrote:
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



--
 "Debugging is twice as hard as writing the code in the first place.
  Therefore, if you write the code as cleverly as possible, you are,
  by definition, not smart enough to debug it." -- Brian Kernighan

reply via email to

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