On Fri, 2 Oct 2015, Eric Botcazou wrote: > > Yep, I was thinking of alignment. I think we are safe here as we are safe > > with any other memory access properties in the references. Those are not > > supposed to be preserved by useless_type_conversions. > > Some explicit type casts need to be preserved on memory accesses, see the > TYPE_ALIGN_OK flag; this is needed for Ada on strict-alignment platforms.
I believe TYPE_ALIGN_OK should be "lowered" so that if you have a handled-component chain with some intermediate TYPE_ALIGN_OK you lower it to taking the address of that component and dereferencing it (which is where the middle-end always trusts the alignment of the type of the dereference). I don't think we honor TYPE_ALIGN_OK "ok" everywhere ("ok" in the optimistic sense). Richard.