This is the fix for the testcase in PR50067. We strip outermost (yes, outermost only, which makes it very inefficient) MEM_REFs which causes the DR base objects in the PR to agree for two conflicting DRs, but with the issues we have with how we compose access functions they still get disambiguated.
Bootstrap and regtest pending on x86_64-unknown-linux-gnu. Richard. 2011-08-19 Richard Guenther <rguent...@suse.de> PR tree-optimization/50067 * tree-data-ref.c (dr_analyze_indices): Do not strip outermost MEM_REF off its ADDR_EXPR operand. * gcc.dg/torture/pr50067-3.c: New testcase. Index: gcc/tree-data-ref.c =================================================================== *** gcc/tree-data-ref.c (revision 177895) --- gcc/tree-data-ref.c (working copy) *************** dr_analyze_indices (struct data_referenc *** 885,895 **** TREE_OPERAND (aref, 1) = build_int_cst (TREE_TYPE (TREE_OPERAND (aref, 1)), 0); - if (TREE_CODE (ref) == MEM_REF - && TREE_CODE (TREE_OPERAND (ref, 0)) == ADDR_EXPR - && integer_zerop (TREE_OPERAND (ref, 1))) - ref = TREE_OPERAND (TREE_OPERAND (ref, 0), 0); - /* For canonicalization purposes we'd like to strip all outermost zero-offset component-refs. ??? For now simply handle zero-index array-refs. */ --- 885,890 ---- Index: gcc/testsuite/gcc.dg/torture/pr50067-3.c =================================================================== *** gcc/testsuite/gcc.dg/torture/pr50067-3.c (revision 0) --- gcc/testsuite/gcc.dg/torture/pr50067-3.c (revision 0) *************** *** 0 **** --- 1,20 ---- + /* { dg-do run } */ + /* { dg-options "-fpredictive-commoning" } */ + + extern void abort (void); + int a[6] = { 0, 0, 0, 0, 7, 0 }; + static int *p = &a[4]; + + int + main () + { + int i; + for (i = 0; i < 4; ++i) + { + a[i + 1] = a[i + 2] > i; + *p &= ~1; + } + if (a[4] != 0) + abort (); + return 0; + }