From: Richard Biener Date: Mon, 15 May 2017 07:56:00 +0000 (+0000) Subject: Revert backport of PR middle-end/80222 X-Git-Tag: releases/gcc-5.5.0~364 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=b7f2b1aa18012c559a9b08006d46f2b41b0711ec;p=thirdparty%2Fgcc.git Revert backport of PR middle-end/80222 2017-05-15 Richard Biener Revert backport of PR middle-end/80222 * gimple-fold.c (gimple_fold_indirect_ref): Do not touch TYPE_REF_CAN_ALIAS_ALL references. * fold-const.c (fold_indirect_ref_1): Likewise. * g++.dg/pr80222.C: New testcase. From-SVN: r248048 --- diff --git a/gcc/ChangeLog b/gcc/ChangeLog index b26b35523691..a5c810fbb9f2 100644 --- a/gcc/ChangeLog +++ b/gcc/ChangeLog @@ -1,3 +1,11 @@ +2017-05-15 Richard Biener + + Revert backport of + PR middle-end/80222 + * gimple-fold.c (gimple_fold_indirect_ref): Do not touch + TYPE_REF_CAN_ALIAS_ALL references. + * fold-const.c (fold_indirect_ref_1): Likewise. + 2017-05-10 Richard Biener Backport from mainline diff --git a/gcc/fold-const.c b/gcc/fold-const.c index 48b32532421d..7adefba83cbc 100644 --- a/gcc/fold-const.c +++ b/gcc/fold-const.c @@ -15876,8 +15876,7 @@ fold_indirect_ref_1 (location_t loc, tree type, tree op0) STRIP_NOPS (sub); subtype = TREE_TYPE (sub); - if (!POINTER_TYPE_P (subtype) - || TYPE_REF_CAN_ALIAS_ALL (TREE_TYPE (op0))) + if (!POINTER_TYPE_P (subtype)) return NULL_TREE; if (TREE_CODE (sub) == ADDR_EXPR) diff --git a/gcc/gimple-fold.c b/gcc/gimple-fold.c index 81dc92064e24..7950cb627fd0 100644 --- a/gcc/gimple-fold.c +++ b/gcc/gimple-fold.c @@ -5910,8 +5910,8 @@ gimple_val_nonnegative_real_p (tree val) return false; } -/* Given a pointer value T, return a simplified version of an - indirection through T, or NULL_TREE if no simplification is +/* Given a pointer value OP0, return a simplified version of an + indirection through OP0, or NULL_TREE if no simplification is possible. Note that the resulting type may be different from the type pointed to in the sense that it is still compatible from the langhooks point of view. */ @@ -5925,8 +5925,7 @@ gimple_fold_indirect_ref (tree t) STRIP_NOPS (sub); subtype = TREE_TYPE (sub); - if (!POINTER_TYPE_P (subtype) - || TYPE_REF_CAN_ALIAS_ALL (ptype)) + if (!POINTER_TYPE_P (subtype)) return NULL_TREE; if (TREE_CODE (sub) == ADDR_EXPR) diff --git a/gcc/testsuite/ChangeLog b/gcc/testsuite/ChangeLog index cb54cdcd45ff..2bd85262f593 100644 --- a/gcc/testsuite/ChangeLog +++ b/gcc/testsuite/ChangeLog @@ -1,3 +1,9 @@ +2017-05-15 Richard Biener + + Revert backport of + PR middle-end/80222 + * g++.dg/pr80222.C: New testcase. + 2017-05-10 Richard Biener Backport from mainline diff --git a/gcc/testsuite/g++.dg/pr80222.C b/gcc/testsuite/g++.dg/pr80222.C deleted file mode 100644 index ed1b37f5e374..000000000000 --- a/gcc/testsuite/g++.dg/pr80222.C +++ /dev/null @@ -1,13 +0,0 @@ -// { dg-do compile } -// { dg-options "-O2 -fdump-tree-optimized" } */ - -struct C { int i; }__attribute__((may_alias)) ; - -C a, b; - -int main() -{ - a = static_cast (b); -} - -// { dg-final { scan-tree-dump "{ref-all}\\\)&b\];" "optimized" } } */