This is the mail archive of the
mailing list for the GCC project.
Re: arrays and typedefs
- From: Jim Wilson <wilson at specifixinc dot com>
- To: Richard Buchmann <Richard dot Buchmann at lip6 dot fr>
- Cc: gcc at gcc dot gnu dot org
- Date: Mon, 22 Sep 2003 23:46:21 -0700
- Subject: Re: arrays and typedefs
- References: <20030919160743.A7611@bip.lip6.fr>
Richard Buchmann wrote:
the original type of var1 is described by a ARRAY_TYPE node of INTEGER_TYPE.
TREE_TYPE return the original type. The TREE_TYPE macro return the original type instead of the expected ARRAY_TYPE node of TYPE_DECL node : the informations about the typedef seems to be missing.
The full type info is there as can be seen from the debug info. If I
compile with -gdwarf-2 -dA -S and look at the output, I see
.uleb128 0x6 # (DIE (0xa8) DW_TAG_variable)
.ascii "var1\0" # DW_AT_name
.long 0x98 # DW_AT_type
.uleb128 0x4 # (DIE (0x98) DW_TAG_array_type)
.long 0x5d # DW_AT_type
.uleb128 0x2 # (DIE (0x5d) DW_TAG_typedef)
.ascii "t2\0" # DW_AT_name
.long 0x67 # DW_AT_type
.uleb128 0x3 # (DIE (0x67) DW_TAG_base_type)
.ascii "int\0" # DW_AT_name
So the type info is what we want. An array of typedef t2, where t2 is
int. If you want to know how this works, I suggest looking at the debug
info output files, such as dwarf2out.c.
By the way, the tu files are debugging aids only. They are not
definitive, and they are intentionally incomplete to try to prevent
people from subverting the GPL. This can be inconvenient, but it is
current FSF policy, so we gcc maintainers must respect it.
Jim Wilson, GNU Tools Support, http://www.SpecifixInc.com