On Tue, Aug 30, 2011 at 4:59 AM, Richard Guenther <rguent...@suse.de> 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)
>
> Richard.
>
> 2011-08-30  Richard Guenther  <rguent...@suse.de>
>
>        PR middle-end/48571
>        * gimple.h (maybe_fold_offset_to_address): Remove.
>        (maybe_fold_offset_to_reference): Likewise.
>        (maybe_fold_stmt_addition): Likewise.
>        (may_propagate_address_into_dereference): Likewise.
>        * tree-inline.c (remap_gimple_op_r): Do not reconstruct
>        array references.
>        * gimple-fold.c (canonicalize_constructor_val): Likewise.
>        Canonicalize invariant POINTER_PLUS_EXPRs to invariant MEM_REF
>        addresses instead.
>        (may_propagate_address_into_dereference): Remove.
>        (maybe_fold_offset_to_array_ref): Likewise.
>        (maybe_fold_offset_to_reference): Likewise.
>        (maybe_fold_offset_to_address): Likewise.
>        (maybe_fold_stmt_addition): Likewise.
>        (fold_gimple_assign): Do not reconstruct array references but
>        instead canonicalize invariant POINTER_PLUS_EXPRs to invariant
>        MEM_REF addresses.
>        (gimple_fold_stmt_to_constant_1): Likewise.
>        * tree-ssa-forwprop.c (forward_propagate_addr_expr_1): Likewise.
>        * gimplify.c (gimplify_conversion): Likewise.
>        (gimplify_expr): Likewise.
>
>        * gcc.c-torture/execute/pr48571-1.c: New testcase.
>        * gcc.dg/pr36902.c: XFAIL.
>

This caused:

http://gcc.gnu.org/bugzilla/show_bug.cgi?id=50460

-- 
H.J.

Reply via email to