On Thursday 13 March 2008 09:14:07 Andy Dougherty wrote: > On Thu, 13 Mar 2008, Nicholas Clark via RT wrote:
> > Specifically, I am suspecting that if > > > > offsetof(struct parrot_string_t, bufused) == sizeof(Buffer) > > > > matters, then something is either looking at or copying (sub)structures > > than happen to have padding, and in turn that padding happens to end up > > with bit patterns that have meaning in some other, larger (containing?) > > structure. > Yes. That's exactly my suspicion. Strings are stored in "bufferlike" > pools, and many of the mainpulations in src/headers.c involve > sizeof(Buffer), even though there is no actual "Buffer" inside a string > anymore. To be fair, though, there's a *lot* more going on in parrot's > memory management that I just don't understand, and I have been unable > to pinpoint a specific assignment that is in error. Originally I was going to ask "Why would there be padding at the end of a Buffer?" but now I realize that the real question is "Is there padding in parrot_string_t between flags and strstart?" It looks like the UnionVal is two pointers long, so if we rearranged things such that flags comes first, would the Buffer structure get padded so that anything after that in memory starts at the appropriate alignment for a pointer? -- c