PR 27087, fix for gcc-4.1 branch

Jeffrey A Law law@redhat.com
Tue Apr 18 17:23:00 GMT 2006


This is the same patch that was installed on the mainline a week
or so ago.  Bootstrapped and regression tested on i686-pc-linux-gnu.


-------------- next part --------------
	PR/27087
	* tree-ssa-copy.c (may_propagate_copy): Test flow sensitive
	alias information too.

	* gcc.c-torture/compile/pr27087.c: New test.

Index: testsuite/gcc.c-torture/compile/pr27087.c
===================================================================
*** testsuite/gcc.c-torture/compile/pr27087.c	(revision 0)
--- testsuite/gcc.c-torture/compile/pr27087.c	(revision 0)
***************
*** 0 ****
--- 1,23 ----
+ extern int ptbl[4];
+ extern int ctbl[4];
+ 
+ void doViews(void) {
+     int  *c = ctbl, *p = ptbl;
+     while (1)
+   {
+         p++;
+         c++;
+         if (*p)
+         {
+             if (c == p)
+             {
+                 if (*c)
+                     return;
+             }
+             else
+               return;
+         }
+     }
+ 
+     g();
+ }
Index: tree-ssa-copy.c
===================================================================
*** tree-ssa-copy.c	(revision 112848)
--- tree-ssa-copy.c	(working copy)
*************** may_propagate_copy (tree dest, tree orig
*** 117,122 ****
--- 117,137 ----
        else if (get_alias_set (TREE_TYPE (type_d)) != 
  	       get_alias_set (TREE_TYPE (type_o)))
  	return false;
+ 
+       /* Also verify flow-sensitive information is compatible.  */
+       if (SSA_NAME_PTR_INFO (orig) && SSA_NAME_PTR_INFO (dest))
+ 	{
+ 	  struct ptr_info_def *orig_ptr_info = SSA_NAME_PTR_INFO (orig);
+ 	  struct ptr_info_def *dest_ptr_info = SSA_NAME_PTR_INFO (dest);
+ 
+ 	  if (orig_ptr_info->name_mem_tag
+ 	      && dest_ptr_info->name_mem_tag
+ 	      && orig_ptr_info->pt_vars
+ 	      && dest_ptr_info->pt_vars
+ 	      && !bitmap_intersect_p (dest_ptr_info->pt_vars,
+ 				      orig_ptr_info->pt_vars))
+ 	    return false;
+ 	}
      }
  
    /* If the destination is a SSA_NAME for a virtual operand, then we have


More information about the Gcc-patches mailing list