This is the mail archive of the 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 PR39625(?)

This fixes PR39625 or at least the reduced testcase therein.  The issue
is that since the removal of the gimple formal temporary stuff and
the extra temporary creation for register call results during
gimplification non-local gotos and longjmp may now result in overlapping
lifetimes of abnormal SSA names.  For EH I fixed the same issue during
EH lowering, the following patch applies the same fix to CFG creation.

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


2009-04-16  Richard Guenther  <>

	PR middle-end/39625
	* tree-cfg.c (make_blocks): Split statements with to-be
	abnormal SSA names on the lhs.

Index: gcc/tree-cfg.c
--- gcc/tree-cfg.c.orig	2009-04-16 11:22:25.000000000 +0200
+++ gcc/tree-cfg.c	2009-04-16 11:20:46.000000000 +0200
@@ -375,7 +375,29 @@ make_blocks (gimple_seq seq)
       /* If STMT is a basic block terminator, set START_NEW_BLOCK for the
 	 next iteration.  */
       if (stmt_ends_bb_p (stmt))
-	start_new_block = true;
+	{
+	  /* If the stmt can make abnormal goto use a new temporary
+	     for the assignment to the LHS.  This makes sure the old value
+	     of the LHS is available on the abnormal edge.  Otherwise
+	     we will end up with overlapping life-ranges for abnormal
+	     SSA names.  */
+	  if (gimple_has_lhs (stmt)
+	      && stmt_can_make_abnormal_goto (stmt)
+	      && is_gimple_reg_type (TREE_TYPE (gimple_get_lhs (stmt))))
+	    {
+	      tree lhs = gimple_get_lhs (stmt);
+	      tree tmp = create_tmp_var (TREE_TYPE (lhs), NULL);
+	      gimple s = gimple_build_assign (lhs, tmp);
+	      gimple_set_location (s, gimple_location (stmt));
+	      gimple_set_block (s, gimple_block (stmt));
+	      gimple_set_lhs (stmt, tmp);
+	      if (TREE_CODE (TREE_TYPE (tmp)) == COMPLEX_TYPE
+		DECL_GIMPLE_REG_P (tmp) = 1;
+	      gsi_insert_after (&i, s, GSI_SAME_STMT);
+	    }
+	  start_new_block = true;
+	}
       gsi_next (&i);
       first_stmt_of_seq = false;

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