------- Additional Comments From dberlin at gcc dot gnu dot org 2005-09-28 02:03 ------- I meant the next field of *B* was a type_decl fields <field_decl 0x40212450 _vptr.B type <pointer_type 0x401f005c type <pointer_type 0x401e5f74 __vtbl_ptr_type> unsigned SI size <integer_cst 0x401693f0 constant invariant 32> unit size <integer_cst 0x40169180 constant invariant 4> align 32 symtab 0 alias set -1> unsigned virtual SI file /home/dberlin/22488.cc line 15 size <integer_cst 0x401693f0 32> unit size <integer_cst 0x40169180 4> align 32 offset_align 128 offset <integer_cst 0x40169198 constant invariant 0> bit offset <integer_cst 0x40169960 constant invariant 0> context <record_type 0x40212170 B> chain <type_decl 0x401eec98 B type <record_type 0x40212170 B> nonlocal decl_4 VOID file /home/dberlin/22488.cc line 15 align 1 context <record_type 0x40212170 B> chain <field_decl 0x40212564 D.1781>>>
(vptr.b, chained to type_decl,chained to D.1781) In C, we have b -> x -> type_decl for C However, the questions still remains, what is the offset supposed to be relative to? The direct context, or the outermost containing type? The way the docs are worded, seems to say the outermost containing (IE the structure that contains them all). Otherwise, to calculate the offset of the second field you have to walk the *entire* nest of types/fields that make up the first field of a structure, which isn't what we are doing. The docs just say "relative to the structure", which is unhelpful :) -- http://gcc.gnu.org/bugzilla/show_bug.cgi?id=22488