[PATCH] Fix PR41261

Richard Guenther rguenther@suse.de
Sun Sep 6 16:44:00 GMT 2009


This fixes PR41261, the oracle was not expecting a FUNCTION_DECL
as base.  Fixed conservatively.

Bootstrapped and tested on x86_64-unknown-linux-gnu, applied to trunk.

Richard.

2009-09-06  Richard Guenther  <rguenther@suse.de>

	PR middle-end/41261
	* tree-ssa-alias.c (refs_may_alias_p_1): Bail out for function decls.

	* gcc.dg/torture/pr41261.c: New testcase.

Index: gcc/tree-ssa-alias.c
===================================================================
*** gcc/tree-ssa-alias.c	(revision 151458)
--- gcc/tree-ssa-alias.c	(working copy)
*************** refs_may_alias_p_1 (ao_ref *ref1, ao_ref
*** 784,789 ****
--- 784,795 ----
        || 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
       references based on two decls.  Do this before defering to
       TBAA to handle must-alias cases in conformance with the
Index: gcc/testsuite/gcc.dg/torture/pr41261.c
===================================================================
*** gcc/testsuite/gcc.dg/torture/pr41261.c	(revision 0)
--- gcc/testsuite/gcc.dg/torture/pr41261.c	(revision 0)
***************
*** 0 ****
--- 1,8 ----
+ /* { dg-do compile } */
+ /* { dg-options "-fprofile-arcs" } */
+ 
+ extern void relocate_kernel();
+ void machine_kexec(void *control_page)
+ { 
+   __builtin_memcpy(control_page, relocate_kernel, 2048);
+ }



More information about the Gcc-patches mailing list