This is the mail archive of the
gcc-patches@gcc.gnu.org
mailing list for the GCC project.
[PATCH] Fix PR44674
- From: Richard Guenther <rguenther at suse dot de>
- To: gcc-patches at gcc dot gnu dot org
- Date: Sat, 26 Jun 2010 15:21:41 +0200 (CEST)
- Subject: [PATCH] Fix PR44674
Bootstrapped and tested on x86_64-unknown-linux-gnu, committed.
Richard.
2010-06-26 Richard Guenther <rguenther@suse.de>
PR middle-end/44674
* tree-ssa-alias.c (refs_may_alias_p_1): Allow all kind of
decls. Handle LABEL_DECLs like FUNCTION_DECLs.
* gcc.dg/pr44674.c: New testcase.
Index: gcc/tree-ssa-alias.c
===================================================================
*** gcc/tree-ssa-alias.c (revision 161428)
--- gcc/tree-ssa-alias.c (working copy)
*************** refs_may_alias_p_1 (ao_ref *ref1, ao_ref
*** 800,817 ****
bool var1_p, var2_p, ind1_p, ind2_p;
alias_set_type set;
! gcc_assert ((!ref1->ref
! || SSA_VAR_P (ref1->ref)
! || handled_component_p (ref1->ref)
! || INDIRECT_REF_P (ref1->ref)
! || TREE_CODE (ref1->ref) == TARGET_MEM_REF
! || TREE_CODE (ref1->ref) == CONST_DECL)
! && (!ref2->ref
! || SSA_VAR_P (ref2->ref)
! || handled_component_p (ref2->ref)
! || INDIRECT_REF_P (ref2->ref)
! || TREE_CODE (ref2->ref) == TARGET_MEM_REF
! || TREE_CODE (ref2->ref) == CONST_DECL));
/* Decompose the references into their base objects and the access. */
base1 = ao_ref_base (ref1);
--- 800,815 ----
bool var1_p, var2_p, ind1_p, ind2_p;
alias_set_type set;
! gcc_checking_assert ((!ref1->ref
! || DECL_P (ref1->ref)
! || handled_component_p (ref1->ref)
! || INDIRECT_REF_P (ref1->ref)
! || TREE_CODE (ref1->ref) == TARGET_MEM_REF)
! && (!ref2->ref
! || DECL_P (ref2->ref)
! || handled_component_p (ref2->ref)
! || INDIRECT_REF_P (ref2->ref)
! || TREE_CODE (ref2->ref) == TARGET_MEM_REF));
/* Decompose the references into their base objects and the access. */
base1 = ao_ref_base (ref1);
*************** refs_may_alias_p_1 (ao_ref *ref1, ao_ref
*** 832,841 ****
|| is_gimple_min_invariant (base2))
return false;
! /* We can end up refering to code via function decls. As we likely
! do not properly track code aliases conservatively bail out. */
if (TREE_CODE (base1) == FUNCTION_DECL
! || TREE_CODE (base2) == FUNCTION_DECL)
return true;
/* Defer to simple offset based disambiguation if we have
--- 830,842 ----
|| is_gimple_min_invariant (base2))
return false;
! /* We can end up refering to code via function and label decls.
! As we likely do not properly track code aliases conservatively
! bail out. */
if (TREE_CODE (base1) == FUNCTION_DECL
! || TREE_CODE (base2) == FUNCTION_DECL
! || TREE_CODE (base1) == LABEL_DECL
! || TREE_CODE (base2) == LABEL_DECL)
return true;
/* Defer to simple offset based disambiguation if we have
Index: gcc/testsuite/gcc.dg/pr44674.c
===================================================================
*** gcc/testsuite/gcc.dg/pr44674.c (revision 0)
--- gcc/testsuite/gcc.dg/pr44674.c (revision 0)
***************
*** 0 ****
--- 1,10 ----
+ /* { dg-do compile } */
+ /* { dg-options "-O -fprofile-generate" } */
+
+ void
+ jumpfunc (void *p)
+ {
+ void *l = &&jumplabel;
+ jumplabel:
+ __builtin_memcpy (p, l, 1);
+ }