Hi everybody,
I am working on the intermediary tree representation of GCC right now
(writing a parser for it). I have a question regarding that.
If I declare a struct containing 2 fields like that in C:
struct foo {
int var_a;
char var_b;
} afoo;
afoo.var_a = 0;
afoo.var_b = 'a';
the abstract syntax tree I get (with -fdump-tree-original) does not
include information about the 2nd field (var_b) at the point of
declaration of the struct type. The declaration of 'var_b" is done only
at the point where I use it. That can be seen from the following struct
type declaration (in intermediary representation):
@147 var_decl name: @149 type: @150 scpe: @1
srcp: InitAutoTestA.c:37 size: @6
algn: 32 used: 1
@149 identifier_node strg: "afoo " lngt:4
@150 record_type name: @153 size: @6 algn: 32
struct flds: @154 fncs: @155
binf: @156
@152 expr_stmt line: 40 expr: @159 next: @160
@153 type_decl name: @161 type: @150 scpe: @1
srcp: InitAutoTestA.c:34 artificial
@154 field_decl name: @162 type: @7 scpe: @150
srcp: InitAutoTestA.c:35 public
size: @10 algn: 32 bpos: @163
@155 function_decl name: @164 type: @165 scpe: @150
srcp: InitAutoTestA.c:34 artificial
operator assign member
public args: @166 undefined
static
@156 binfo type: @150
@161 identifier_node strg: "foo " lngt:3
@162 identifier_node strg: "var_a " lngt:5
@163 integer_cst type: @13 low : 0
the flds field of the record_type (@150) points to the field_decl of
var_a (@154), but there is not link to the field_decl of var_b at that
place.
However the GCC documentation (section 9.4.2 Classes) says: "Almost all
non-function members are available on the TYPE_FIELDS list. Given one
member, the next can be found by following the TREE_CHAIN." But I see no
chain or list in the present case.
I am using gcc version 3.3.5 (under Debian Linux).
Has anyone an idea why there is no link to the next field?
Cheers,
Pat