[tuples] Fix tree-ssa-threadedge.c

Jakub Jelinek jakub@redhat.com
Wed Jul 16 22:51:00 GMT 2008


Hi!

During the latest bootstrap I got ICE while building libjava.
The second argument to the simplify callback (in this case
vrp_evaluate_conditional) is used to grab location_t,
          location_t location;

          if (!gimple_has_location (stmt))
            location = input_location;
          else
            location = gimple_location (stmt);

so passing NULL there doesn't work well.  On the trunk stmt
is passed in all 3 places
grep '=.*simplify) (' tree-ssa-threadedge.c
	        cached_lhs = (*simplify) (stmt, stmt);
	cached_lhs = (*simplify) (dummy_cond, stmt);
        cached_lhs = (*simplify) (stmt, stmt);
and so does this patch.  Bootstrapped/regtested on x86_64-linux,
will commit RSN.

2008-07-16  Jakub Jelinek  <jakub@redhat.com>

	* tree-ssa-threadedge.c (record_temporary_equivalences_for_stmts,
	simplify_control_stmt_condition): Pass stmt instead of NULL as second
	argument to simplify callback.

--- gcc/tree-ssa-threadedge.c.jj	2008-07-16 12:31:12.000000000 +0200
+++ gcc/tree-ssa-threadedge.c	2008-07-16 20:11:08.000000000 +0200
@@ -379,7 +379,7 @@ record_temporary_equivalences_from_stmts
           if (!cached_lhs
               || (TREE_CODE (cached_lhs) != SSA_NAME
                   && !is_gimple_min_invariant (cached_lhs)))
-            cached_lhs = (*simplify) (stmt, NULL);
+            cached_lhs = (*simplify) (stmt, stmt);
           
 	  /* Restore the statement's original uses/defs.  */
 	  i = 0;
@@ -495,7 +495,7 @@ simplify_control_stmt_condition (edge e,
 	 then use the pass specific callback to simplify the condition.  */
       if (!cached_lhs
           || !is_gimple_min_invariant (cached_lhs))
-        cached_lhs = (*simplify) (dummy_cond, NULL);
+        cached_lhs = (*simplify) (dummy_cond, stmt);
 
       return cached_lhs;
     }
@@ -531,7 +531,7 @@ simplify_control_stmt_condition (edge e,
       /* If we haven't simplified to an invariant yet, then use the
 	 pass specific callback to try and simplify it further.  */
       if (cached_lhs && ! is_gimple_min_invariant (cached_lhs))
-        cached_lhs = (*simplify) (stmt, NULL);
+        cached_lhs = (*simplify) (stmt, stmt);
     }
   else
     cached_lhs = NULL;


	Jakub



More information about the Gcc-patches mailing list