Commit 737f500a by Richard Biener Committed by Richard Biener

re PR middle-end/80222 (may_alias folded away)

2017-03-28  Richard Biener  <rguenther@suse.de>

	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: r246527
parent 62f96a79
2017-03-28 Richard Biener <rguenther@suse.de>
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-03-28 Martin Liska <mliska@suse.cz> 2017-03-28 Martin Liska <mliska@suse.cz>
PR ipa/80104 PR ipa/80104
......
...@@ -14006,7 +14006,8 @@ fold_indirect_ref_1 (location_t loc, tree type, tree op0) ...@@ -14006,7 +14006,8 @@ fold_indirect_ref_1 (location_t loc, tree type, tree op0)
STRIP_NOPS (sub); STRIP_NOPS (sub);
subtype = TREE_TYPE (sub); subtype = TREE_TYPE (sub);
if (!POINTER_TYPE_P (subtype)) if (!POINTER_TYPE_P (subtype)
|| TYPE_REF_CAN_ALIAS_ALL (TREE_TYPE (op0)))
return NULL_TREE; return NULL_TREE;
if (TREE_CODE (sub) == ADDR_EXPR) if (TREE_CODE (sub) == ADDR_EXPR)
......
...@@ -6539,8 +6539,8 @@ gimple_get_virt_method_for_binfo (HOST_WIDE_INT token, tree known_binfo, ...@@ -6539,8 +6539,8 @@ gimple_get_virt_method_for_binfo (HOST_WIDE_INT token, tree known_binfo,
return gimple_get_virt_method_for_vtable (token, v, offset, can_refer); return gimple_get_virt_method_for_vtable (token, v, offset, can_refer);
} }
/* Given a pointer value OP0, return a simplified version of an /* Given a pointer value T, return a simplified version of an
indirection through OP0, or NULL_TREE if no simplification is indirection through T, or NULL_TREE if no simplification is
possible. Note that the resulting type may be different from possible. Note that the resulting type may be different from
the type pointed to in the sense that it is still compatible the type pointed to in the sense that it is still compatible
from the langhooks point of view. */ from the langhooks point of view. */
...@@ -6554,7 +6554,8 @@ gimple_fold_indirect_ref (tree t) ...@@ -6554,7 +6554,8 @@ gimple_fold_indirect_ref (tree t)
STRIP_NOPS (sub); STRIP_NOPS (sub);
subtype = TREE_TYPE (sub); subtype = TREE_TYPE (sub);
if (!POINTER_TYPE_P (subtype)) if (!POINTER_TYPE_P (subtype)
|| TYPE_REF_CAN_ALIAS_ALL (ptype))
return NULL_TREE; return NULL_TREE;
if (TREE_CODE (sub) == ADDR_EXPR) if (TREE_CODE (sub) == ADDR_EXPR)
......
2017-03-28 Richard Biener <rguenther@suse.de>
PR middle-end/80222
* g++.dg/pr80222.C: New testcase.
2017-03-28 Martin Liska <mliska@suse.cz> 2017-03-28 Martin Liska <mliska@suse.cz>
PR ipa/80104 PR ipa/80104
......
// { dg-do compile }
// { dg-options "-O2 -fdump-tree-optimized" } */
struct C { int i; }__attribute__((may_alias)) ;
C a, b;
int main()
{
a = static_cast <C&> (b);
}
// { dg-final { scan-tree-dump "{ref-all}\\\)&b\];" "optimized" } } */
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment