On Mon, Dec 12, 2011 at 12:40 PM, Eric Botcazou <ebotca...@adacore.com> wrote: >> Well, I can live with this change (though I cannot approve anything). >> On the other hand, the real underlying problem is that expander cannot >> handle unaligned MEM_REFs where strict alignment is required. SRA is >> of course much more prone to create such situations than anything else >> but I wonder whether they can creep up elsewhere too. It also takes >> us in the opposite direction than the one initially intended with >> MEM_REFs, doesn't it? > > Certainly, but we need to fix the regression in a relatively safe manner. > >> That said, I looked into the expander briefly in summer but given my >> level of experience in that area I did not nearly have enough time. I >> still plan to look into this issue in expander but for the same >> reasons I cannot guarantee any quick success. So I acknowledge this is >> the only working approach to a long-standing difficult bug... and most >> probably the most appropriate for the 4.6 branch. > > Thanks. This is still the same very old issue: misalignment cannot be handled > indirectly (because we don't really have misaligned pointers) so MEM_REFs can > be used safely only when everything is properly aligned.
We do have misaligned accesses - TYPE_ALIGN of TREE_TYPE of the MEM_REF reflects that. Similar to how would do typedef int myint __attribute__((aligned(1))); int foo (myint *p) { return *p; } which is a testcase that is "miscompiled" since forever on STRICT_ALIGNMENT targets (well, maybe apart from now for those who implement movmisalign). The fix is to fix the above testcase (which is a good idea anyway) and then to make sure to transition misaligned information to TREE_TYPE of the MEM_REF we create. Richard.