On Mon, May 09, 2011 at 01:41:13PM -0500, Aldy Hernandez wrote: > Jakub also gave me a testcase which triggered a buglet in > max_field_size. I have now added a parameter INNERDECL which is the > inner reference, so we can properly determine if the inner decl is > thread visible or not.
What I meant actually was something different, if max_field_size and get_inner_reference was called on say COMPONENT_REF <ARRAY_REF <x, 4>, bitfld> then get_inner_reference returns the whole x and bitpos is the relative bit position of bitfld within the struct plus 4 * sizeof the containing struct. Then TREE_INT_CST_LOW (TYPE_SIZE (record_type)) - bitpos might get negative (well, it is unsigned, so huge). Maybe with MEM_REF such nested handled components shouldn't appear, if that's the case, you should assert that somewhere. If it appears, you should probably use TREE_OPERAND (component_ref, 2) instead of bitpos. BTW, shouldn't BIT_FIELD_REF also be handled similarly to the COMPONENT_REF? And, probably some coordination with Richi is needed with his bitfield tree lowering. Jakub