This is the mail archive of the mailing list for the GCC project.

Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

Re: arrays and typedefs

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,

Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]