On Fri, Nov 04, 2016 at 08:07:37PM +0100, Richard Biener wrote:
> >If/once this is in, I'm planning to test/submit a patch adding
> >  /* If one decl is known to be a function or label in a function and
> >     the other is some kind of data, they can't overlap.  */
> >  if ((TREE_CODE (exprx) == FUNCTION_DECL
> >       || TREE_CODE (exprx) == LABEL_DECL)
> >      != (TREE_CODE (expry) == FUNCTION_DECL
> >       || TREE_CODE (expry) == LABEL_DECL))
> >    return 1;
> >before that.
> >
> >Bootstrapped/regtested on x86_64-linux and i686-linux, ok for trunk?
> 
> OK for trunk and branches (if appropriate)

And here is the incremental patch to disambiguate between code section
objects and variables.

Bootstrapped/regtested on x86_64-linux and i686-linux, ok for trunk (only)?

2016-11-07  Jakub Jelinek  <ja...@redhat.com>

        PR target/77834
        * alias.c (nonoverlapping_memrefs_p): If one decl is
        FUNCTION_DECL or LABEL_DECL and the other is not, return 1.

--- gcc/alias.c.jj      2016-11-04 20:13:32.000000000 +0100
+++ gcc/alias.c 2016-11-07 11:18:57.982160034 +0100
@@ -2755,6 +2755,14 @@ nonoverlapping_memrefs_p (const_rtx x, c
       || TREE_CODE (expry) == CONST_DECL)
     return 1;
 
+  /* If one decl is known to be a function or label in a function and
+     the other is some kind of data, they can't overlap.  */
+  if ((TREE_CODE (exprx) == FUNCTION_DECL
+       || TREE_CODE (exprx) == LABEL_DECL)
+      != (TREE_CODE (expry) == FUNCTION_DECL
+         || TREE_CODE (expry) == LABEL_DECL))
+    return 1;
+
   /* If either of the decls doesn't have DECL_RTL set (e.g. marked as
      living in multiple places), we can't tell anything.  Exception
      are FUNCTION_DECLs for which we can create DECL_RTL on demand.  */
@@ -2804,7 +2812,7 @@ nonoverlapping_memrefs_p (const_rtx x, c
 
   /* Offset based disambiguation not appropriate for loop invariant */
   if (loop_invariant)
-    return 0;              
+    return 0;
 
   /* Offset based disambiguation is OK even if we do not know that the
      declarations are necessarily different


        Jakub

Reply via email to