On 8/22/19 4:46 AM, Richard Biener wrote: >>> Also you seem to use this info to constrain optimization when you >>> might remember that types of addresses do not carry such information... >>> Thus it should be "trivially" possible to write a testcase that is >>> miscompiled >>> after your patch. I also don't see this really exercised in the >>> testcases you add? >> Arggh. You're absolutely correct. I must be blocking out that entire >> discussion from last summer due to the trama :-) >> >> If the destination is the address of a _DECL node, can we use the size >> of the _DECL? > > Yes, but this should already happen for both invariant ones like &a.b.c > and variant ones like &a.b[i].c in ao_ref_init_from_ptr_and_size. I don't see that in ao_ref_init_from_ptr_and_size. AFAICT if you don't know the size when you call that routine (size == NULL), then you end up with the ref->size and ref->max_size set to -1.
Am I missing something here? Jeff