tinycc-devel
[Top][All Lists]
Advanced

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

[Tinycc-devel] Types, and references to other types


From: David Mertens
Subject: [Tinycc-devel] Types, and references to other types
Date: Mon, 27 Jul 2015 11:34:05 -0400

Hello everyone,

I have been playing with symbol table copying and ran into some trouble with uninitialized pointers. I figured my troubles arose because I didn't fully understand the uses of Sym objects, so I thought I'd read through tcc-doc. While reading I came across references to the .t field of Syms, in particular:

"When a reference to another type is needed (for pointers, functions and structures), the 32 - VT_STRUCT_SHIFT high order bits are used to store an identifier reference."

This seems out of date. The current Sym struct does not have a .t field. It has a .type field, which is a CType, which itself has a .t field, but also a .ref field. The .ref is a pointer to the referenced type's Sym. I then grepped through the source. The only code that seems to think that the a type's higher-order bits have a type reference is il-gen.c. Any other shifting of the type.t field assumes that the high bits contain bit field offsets.

Is the tcc-doc.texi out of date?

David

--
 "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]