> On Thu, Nov 12, 2020 at 11:29:21AM +0100, Jan Hubicka wrote: > > > If OEP_ADDRESS is used also on non-addressable stuff, just to compare > > > that two COMPONENT_REFs access the same memory, then just comparing > > > DECL_BIT_FIELD_REPRESENTATIVE is not sufficient, you could have: > > > struct S { int c; int a : 7, b : 1; }; > > > struct T { int c; int a : 7, b : 1; }; > > > and compare s->a vs. t->b with OEP_ADDRESS and the offsets of their > > > DECL_BIT_FIELD_REPRESENATIVE is the same, yet we don't want to say > > > the two bit-fields are the same. > > > > You are right, I was just thinking of that. I suppose it indeed makes > > more sense to assert that there are no bitfields here and in the AO > > comparsion take care of stripping the last bitfield reference and > > handling it specially? > > Or just compare DECL_FIELD_OFFSET and DECL_FIELD_BIT_OFFSET of the fields > rather than their DECL_BIT_FIELD_REPRESENTATIVE?
I think I will need to compare bitfields specially at the ao_ref_compare side anyway to distinguish struct S { int c; int a : 5, b : 1; }; struct T { int c; int a : 5, b : 3; }; s->b and t->b. Those have same base address (bitwise) but still we do not want to consider them equal. So handling this on operand_equal_p is probably not that useful and perhaps extra sanity check would be. I will fire boostrap to see if there is any other place that trips bitfields with OEP_ADDRESS_OF. Thanks, Honza