[cfe-dev] crash fix, need help
Chris Lattner
clattner at apple.com
Sun Dec 9 15:21:01 PST 2007
Devang is the keeper of struct layout :) , any ideas Devang?
-Chris
On Dec 9, 2007, at 1:14 PM, Sean Middleditch wrote:
> Worked on tracking down the crash I have with my small test app,
> a.k.a.
> clc.
>
> The crash is actually a failed assertion at
> RecordOrganizer::addPaddingFields, due to the RequiredBits not being a
> multiple of 8.
>
> The struct in question is struct _win_st from ncurses.h, and the field
> causing this is _clear, which is of type _Bool, and immediately
> followed
> another _Bool, _notimeout. These are the first two _Bool types in the
> source.
>
> The alignment is off by a single bit. I'm figuring what is
> happening is
> that the first _Bool is being added as a single bit field to the
> struct,
> and then the second _Bool is trying to add padding and failing because
> the addPaddingFields method can only add padding with bits in
> multiples
> of 8.
>
> What I'm wondering is what the proper fix is. Either _Bool should
> be an
> 8-bit type, or addPaddingFields needs to be able to pad by arbitrary
> bits _and_ two (or more) consecutive _Bool types should not be forcing
> extra padding. (It seems that _Bool wants 32-bit alignment, for that
> matter, or I'm just failing to understand the meaning of the
> AlignmentInBits calculated in addLLVMField.)
>
> Once that's figured out, of course, I need to determine how to
> actually
> do either of those. :)
>
> By the way, I must say, given its size and the complexity of its
> subject
> material, the clang code is really quite readable. In my line of
> work,
> I run into small 30 line barely-functional scripts that are harder to
> grok than clang. This is great work!
>
> - Sean
>
> _______________________________________________
> cfe-dev mailing list
> cfe-dev at cs.uiuc.edu
> http://lists.cs.uiuc.edu/mailman/listinfo/cfe-dev
More information about the cfe-dev
mailing list