OSDN Git Service

2010-06-26 Richard Guenther <rguenther@suse.de>
authorrguenth <rguenth@138bc75d-0d04-0410-961f-82ee72b054a4>
Sat, 26 Jun 2010 13:24:57 +0000 (13:24 +0000)
committerrguenth <rguenth@138bc75d-0d04-0410-961f-82ee72b054a4>
Sat, 26 Jun 2010 13:24:57 +0000 (13:24 +0000)
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.

git-svn-id: svn+ssh://gcc.gnu.org/svn/gcc/trunk@161431 138bc75d-0d04-0410-961f-82ee72b054a4

gcc/ChangeLog
gcc/testsuite/ChangeLog
gcc/testsuite/gcc.dg/pr44674.c [new file with mode: 0644]
gcc/tree-ssa-alias.c

index 45cffd9..5a2bbac 100644 (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>
 
index 853540f..ae6ce36 100644 (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.
diff --git a/gcc/testsuite/gcc.dg/pr44674.c b/gcc/testsuite/gcc.dg/pr44674.c
new file mode 100644 (file)
index 0000000..c3f16ff
--- /dev/null
@@ -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);
+}
index e6836d7..95f26f1 100644 (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