representation of struct field offsets

Sandra Loosemore sandra@codesourcery.com
Thu Sep 28 22:38:00 GMT 2006


Mark Mitchell wrote:

> Are 
> you going through the stor_layout.c:place_field routines when creating 
> structure types?  If so, I wouldn't; here, you know where stuff is 
> supposed to go, so I would just put it there, and set DECL_FIELD_OFFSET, 
> etc., accordingly.

No, I'm not using the fancy stor_layout.c stuff.  As you say, I already have the 
bit offsets.  Also, the DWARF representation doesn't necessarily include all the 
bits of information that the layout algorithm uses, so it can't reliably 
reproduce the same layout just given the types and sizes of (possibly only some 
of) the fields.

Anyway, I've made a little more progress; Google pointed me at some past 
discussion of this issue and from there a mention that the Ada front end allows 
explicit placement of fields in a record, and I was able to swipe that bit of 
code.  I've got non-bitfields to work properly, but I'm still working on 
debugging the bitfield case.

-Sandra



More information about the Gcc mailing list