This is the mail archive of the gcc-patches@gcc.gnu.org mailing list for the GCC project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

[PATCH] Fix PR38445, alias warning running in circles


I missed that we need to make sure to not run in circles when getting
to definition sites via PHIs.  Thus, fixed.

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

Richard.

2008-12-08  Richard Guenther  <rguenther@suse.de>

	PR tree-optimization/38445
	* tree-ssa-structalias.c (emit_pointer_definition): Only visit
	names once.
	(emit_alias_warning): Adjust.

Index: gcc/tree-ssa-structalias.c
===================================================================
*** gcc/tree-ssa-structalias.c	(revision 142538)
--- gcc/tree-ssa-structalias.c	(working copy)
*************** static bool have_alias_info = false;
*** 4704,4711 ****
  /* Emit a note for the pointer initialization point DEF.  */
  
  static void
! emit_pointer_definition (gimple def)
  {
    if (gimple_code (def) == GIMPLE_PHI)
      {
        use_operand_p argp;
--- 4704,4712 ----
  /* Emit a note for the pointer initialization point DEF.  */
  
  static void
! emit_pointer_definition (tree ptr, bitmap visited)
  {
+   gimple def = SSA_NAME_DEF_STMT (ptr);
    if (gimple_code (def) == GIMPLE_PHI)
      {
        use_operand_p argp;
*************** emit_pointer_definition (gimple def)
*** 4715,4721 ****
  	{
  	  tree arg = USE_FROM_PTR (argp);
  	  if (TREE_CODE (arg) == SSA_NAME)
! 	    emit_pointer_definition (SSA_NAME_DEF_STMT (arg));
  	  else
  	    inform (0, "initialized from %qE", arg);
  	}
--- 4716,4725 ----
  	{
  	  tree arg = USE_FROM_PTR (argp);
  	  if (TREE_CODE (arg) == SSA_NAME)
! 	    {
! 	      if (bitmap_set_bit (visited, SSA_NAME_VERSION (arg)))
! 		emit_pointer_definition (arg, visited);
! 	    }
  	  else
  	    inform (0, "initialized from %qE", arg);
  	}
*************** emit_pointer_definition (gimple def)
*** 4729,4735 ****
  static void
  emit_alias_warning (tree ptr)
  {
-   gimple def = SSA_NAME_DEF_STMT (ptr);
    gimple use;
    imm_use_iterator ui;
    unsigned warned = 0;
--- 4733,4738 ----
*************** emit_alias_warning (tree ptr)
*** 4777,4783 ****
  	}
      }
    if (warned > 0)
!     emit_pointer_definition (def);
  }
  
  /* Given a pointer variable P, fill in its points-to set, or return
--- 4780,4790 ----
  	}
      }
    if (warned > 0)
!     {
!       bitmap visited = BITMAP_ALLOC (NULL);
!       emit_pointer_definition (ptr, visited);
!       BITMAP_FREE (visited);
!     }
  }
  
  /* Given a pointer variable P, fill in its points-to set, or return


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]