re PR tree-optimization/44674 (ICE: in refs_may_alias_p_1, at tree-ssa-alias.c:953 with -fprofile-generate)

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.

From-SVN: r161431
This commit is contained in:
Richard Biener 2010-06-26 13:24:57 +00:00
parent 922e18828a
commit 6bfd430254
4 changed files with 39 additions and 17 deletions

View File

@ -1,3 +1,9 @@
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.
2010-06-26 Joseph Myers <joseph@codesourcery.com>
* gcc.c (n_switches_alloc, n_infiles_alloc, alloc_infile,
@ -10,8 +16,8 @@
2010-06-26 Jan Hubicka <jh@suse.cz>
PR middle-end/44671
* cgraphunit.c (cgraph_function_versioning): Remove wrong cgraph_make_decl_local
call; fix typo copying RTL data.
* cgraphunit.c (cgraph_function_versioning): Remove wrong
cgraph_make_decl_local call; fix typo copying RTL data.
2010-06-25 DJ Delorie <dj@redhat.com>

View File

@ -1,3 +1,8 @@
2010-06-26 Richard Guenther <rguenther@suse.de>
PR middle-end/44674
* gcc.dg/pr44674.c: New testcase.
2010-06-26 Joseph Myers <joseph@codesourcery.com>
* gcc.dg/opts-3.c: New test.

View File

@ -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);
}

View File

@ -800,18 +800,16 @@ refs_may_alias_p_1 (ao_ref *ref1, ao_ref *ref2, bool tbaa_p)
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));
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);
@ -832,10 +830,13 @@ refs_may_alias_p_1 (ao_ref *ref1, ao_ref *ref2, bool tbaa_p)
|| 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. */
/* 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 (base2) == FUNCTION_DECL
|| TREE_CODE (base1) == LABEL_DECL
|| TREE_CODE (base2) == LABEL_DECL)
return true;
/* Defer to simple offset based disambiguation if we have