http://gcc.gnu.org/bugzilla/show_bug.cgi?id=46638
--- Comment #2 from Tobias Burnus <burnus at gcc dot gnu.org> 2010-11-24 08:50:24 UTC --- I wonder whether it should be "bit_offset" (DECL_FIELD_BIT_OFFSET) instead of "offset" (DECL_FIELD_OFFSET). Reading the comment in tree.h (see below), one probably should add the two: DECL_FIELD_OFFSET(...) + DECL_FIELD_BIT_OFFSET (...)/8 (gdb) p debug_tree(result->ts.u.derived->components->backend_decl->field_decl->bit_offset) <integer_cst 0x2aaaaab35b18 type <integer_type 0x2aaaaab450a8 bit_size_type> constant 0> $22 = void (gdb) p debug_tree(result->ts.u.derived->components->next->backend_decl->field_decl->bit_offset) <integer_cst 0x2aaaaab356e0 type <integer_type 0x2aaaaab450a8 bit_size_type> constant 32> $23 = void (gdb) p debug_tree(result->ts.u.derived->components->next->next->backend_decl->field_decl->bit_offset) <integer_cst 0x2aaaaab357a8 type <integer_type 0x2aaaaab450a8 bit_size_type> constant 64> /* In a FIELD_DECL, this is the field position, counting in bytes, of the DECL_OFFSET_ALIGN-bit-sized word containing the bit closest to the beginning of the structure. */ #define DECL_FIELD_OFFSET(NODE) (FIELD_DECL_CHECK (NODE)->field_decl.offset) /* In a FIELD_DECL, this is the offset, in bits, of the first bit of the field from DECL_FIELD_OFFSET. This field may be nonzero even for fields that are not bit fields (since DECL_OFFSET_ALIGN may be larger than the natural alignment of the field's type). */ #define DECL_FIELD_BIT_OFFSET(NODE) \ (FIELD_DECL_CHECK (NODE)->field_decl.bit_offset)