On Tue, 30 Aug 2011, Richard Guenther wrote: > > I've run into PR48571 again, and after having fun with out data-dep > analysis code I indeed believe that we should not try to re-construct > ARRAY_REFs from code involving pointer arithmetic. ARRAY_REFs > have constraints imposed on them that are relied on by data dependence > analysis and that are indeed useful to have (the index is within > bounds, otherwise undefined behavior). We can't recover from > lowering that happened, much as Zdenek argued when I initially > proposed to lower all ARRAY_REFs to pointer arithmetic with the > original MEM_REF design. > > Thus, the following completes the partial removal of reference > re-constructing I did when merging MEM_REFs (I removed the code > re-constructing COMPONENT_REFs back then). > > Not much fallout, much to my surprise (I've tried it initially > on the MEM_REF branch, but quickly gave up on this additional task). > We've appearantly become better in handling of pointer based accesses > (we've already much experience here with GFortran lowering > multi-dimensional array accesses to one-dimensional ones). > > The patch XFAILs one -Warray-bounds testcase, the -Warray-bounds > infrastructure needs some serious TLC which I didn't want to fold > into this patch. The testcase in question also really asks for > an 'access outside of object' warning, similar to the > 'offset outside bounds of constant string' one we have. > > Bootstrapped and tested an earlier version on x86_64-unknown-linux-gnu, > a final bootstrap and regtest cycle is currently running. > > (yes, there are still > tree-ssa-forwprop.c:forward_propagate_addr_into_variable_array_index and > fold-const.c:try_move_mult_to_index)
Actually I forgot * gcc.dg/tree-ssa/ssa-ccp-25.c: Remove. * gcc.dg/tree-ssa/ssa-ccp-26.c: Likewise. which are feature tests for the reconstruction. Likewise I missed a recalculate_side_effects (*expr_p) in POINTER_PLUS_EXPR gimplification. With both fixed, bootstrapped and tested on x86_64-unknown-linxu-gnu and applied to trunk. Richard.