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]

Re: [Bug optimization/14553][tree-ssa] segfault involving pointers


On Fri, 2004-03-12 at 10:02, reichelt at gcc dot gnu dot org wrote:
> ------- Additional Comments From reichelt at gcc dot gnu dot org  2004-03-12 15:02 -------
> Redux (crashes gcc and g++, just compile with -O3):
> 
> ===============================================
> void foo(int* p)
> {
>     int i;
>     for (i=1; i>0; --i, ++p)
>         *p=0;
> }
> 
> void bar(int* p) { foo(p); }
> ===============================================
> 
> Might be related to PR 14433, where the bug magically disappeared today.
> 
It wasn't.  This was another case of a pass doing value propagation not
using propagate_value.  Fixed with patch below.  Will commit after tests
are finished.


Diego.


	PR optimization/14553
	* tree-ssa.c (replace_immediate_uses): Call propagate_value to
	update operands.

Index: tree-ssa.c
===================================================================
RCS file: /cvs/gcc/gcc/gcc/Attic/tree-ssa.c,v
retrieving revision 1.1.4.211
diff -d -c -p -d -u -p -r1.1.4.211 tree-ssa.c
--- tree-ssa.c	12 Mar 2004 04:19:06 -0000	1.1.4.211
+++ tree-ssa.c	13 Mar 2004 03:44:52 -0000
@@ -3850,19 +3850,19 @@ replace_immediate_uses (tree var, tree r
 	  uses = STMT_USE_OPS (stmt);
 	  for (j = 0; j < (int) NUM_USES (uses); j++)
 	    if (USE_OP (uses, j) == var)
-	      *USE_OP_PTR (uses, j) = repl;
+	      propagate_value (USE_OP_PTR (uses, j), repl);
 	}
       else
 	{
 	  vuses = STMT_VUSE_OPS (stmt);
 	  for (j = 0; j < (int) NUM_VUSES (vuses); j++)
 	    if (VUSE_OP (vuses, j) == var)
-	      *VUSE_OP_PTR (vuses, j) = repl;
+	      propagate_value (VUSE_OP_PTR (vuses, j), repl);
 
 	  vdefs = STMT_VDEF_OPS (stmt);
 	  for (j = 0; j < (int) NUM_VDEFS (vdefs); j++)
 	    if (VDEF_OP (vdefs, j) == var)
-	      *VDEF_OP_PTR (vdefs, j) = repl;
+	      propagate_value (VDEF_OP_PTR (vdefs, j), repl);
 	}
 
       modify_stmt (stmt);



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