rpms/gcc/devel gcc43-pr29609-2.patch, NONE, 1.1 gcc43-pr29609-3.patch, NONE, 1.1 gcc43.spec, 1.45, 1.46

Jakub Jelinek jakub at fedoraproject.org
Thu Oct 9 10:25:23 UTC 2008


Author: jakub

Update of /cvs/pkgs/rpms/gcc/devel
In directory cvs1.fedora.phx.redhat.com:/tmp/cvs-serv1766

Modified Files:
	gcc43.spec 
Added Files:
	gcc43-pr29609-2.patch gcc43-pr29609-3.patch 
Log Message:
4.3.2-6

gcc43-pr29609-2.patch:

--- NEW FILE gcc43-pr29609-2.patch ---
2008-10-09  Jakub Jelinek  <jakub at redhat.com>

	* tree-ssa-live.c (remove_unused_locals): Mark all edge's goto_block
	as used.
	* gimple-low.c (lower_return_expr, lower_builtin_setjmp): Set
	TREE_BLOCK on the newly created stmts.
	* tree-cfg.c (make_cond_expr_edges, make_goto_expr_edges): Only set
	goto_block on edges if goto_locus is known.

--- gcc/tree-ssa-live.c.jj	2008-10-07 21:25:57.000000000 +0200
+++ gcc/tree-ssa-live.c	2008-10-09 00:25:20.000000000 +0200
@@ -591,6 +591,8 @@ remove_unused_locals (void)
     {
       block_stmt_iterator bsi;
       tree phi, def;
+      edge_iterator ei;
+      edge e;
 
       /* Walk the statements.  */
       for (bsi = bsi_start (bb); !bsi_end_p (bsi); bsi_next (&bsi))
@@ -614,6 +616,10 @@ remove_unused_locals (void)
 	      mark_all_vars_used (&arg, NULL);
             }
         }
+
+      FOR_EACH_EDGE (e, ei, bb->succs)
+	if (e->goto_locus)
+	  TREE_USED (e->goto_block) = true;
     }
 
   /* Remove unmarked local vars from unexpanded_var_list.  */
--- gcc/gimple-low.c.jj	2008-10-07 21:25:58.000000000 +0200
+++ gcc/gimple-low.c	2008-10-09 00:42:31.000000000 +0200
@@ -590,6 +590,7 @@ lower_return_expr (tree_stmt_iterator *t
  found:
   t = build1 (GOTO_EXPR, void_type_node, label);
   SET_EXPR_LOCUS (t, EXPR_LOCUS (stmt));
+  TREE_BLOCK (t) = TREE_BLOCK (stmt);
   tsi_link_before (tsi, t, TSI_SAME_STMT);
   tsi_delink (tsi);
 }
@@ -672,6 +673,7 @@ lower_builtin_setjmp (tree_stmt_iterator
   t = implicit_built_in_decls[BUILT_IN_SETJMP_SETUP];
   t = build_call_expr (t, 2, CALL_EXPR_ARG (stmt, 0), arg);
   SET_EXPR_LOCUS (t, EXPR_LOCUS (stmt));
+  TREE_BLOCK (t) = TREE_BLOCK (stmt);
   tsi_link_before (tsi, t, TSI_SAME_STMT);
 
   /* Build 'DEST = 0' and insert.  */
@@ -680,6 +682,7 @@ lower_builtin_setjmp (tree_stmt_iterator
       t = build_gimple_modify_stmt (dest, fold_convert (TREE_TYPE (dest),
 							integer_zero_node));
       SET_EXPR_LOCUS (t, EXPR_LOCUS (stmt));
+      TREE_BLOCK (t) = TREE_BLOCK (stmt);
       tsi_link_before (tsi, t, TSI_SAME_STMT);
     }
 
@@ -696,6 +699,7 @@ lower_builtin_setjmp (tree_stmt_iterator
   t = implicit_built_in_decls[BUILT_IN_SETJMP_RECEIVER];
   t = build_call_expr (t, 1, arg);
   SET_EXPR_LOCUS (t, EXPR_LOCUS (stmt));
+  TREE_BLOCK (t) = TREE_BLOCK (stmt);
   tsi_link_before (tsi, t, TSI_SAME_STMT);
 
   /* Build 'DEST = 1' and insert.  */
@@ -704,6 +708,7 @@ lower_builtin_setjmp (tree_stmt_iterator
       t = build_gimple_modify_stmt (dest, fold_convert (TREE_TYPE (dest),
 							integer_one_node));
       SET_EXPR_LOCUS (t, EXPR_LOCUS (stmt));
+      TREE_BLOCK (t) = TREE_BLOCK (stmt);
       tsi_link_before (tsi, t, TSI_SAME_STMT);
     }
 
--- gcc/tree-cfg.c.jj	2008-10-07 21:39:14.000000000 +0200
+++ gcc/tree-cfg.c	2008-10-09 00:00:48.000000000 +0200
@@ -634,7 +634,8 @@ make_cond_expr_edges (basic_block bb)
 #else
   e->goto_locus = EXPR_LOCUS (COND_EXPR_THEN (entry));
 #endif
-  e->goto_block = TREE_BLOCK (COND_EXPR_THEN (entry));
+  if (e->goto_locus)
+    e->goto_block = TREE_BLOCK (COND_EXPR_THEN (entry));
   e = make_edge (bb, else_bb, EDGE_FALSE_VALUE);
   if (e)
     {
@@ -643,7 +644,8 @@ make_cond_expr_edges (basic_block bb)
 #else
       e->goto_locus = EXPR_LOCUS (COND_EXPR_ELSE (entry));
 #endif
-      e->goto_block = TREE_BLOCK (COND_EXPR_ELSE (entry));
+      if (e->goto_locus)
+	e->goto_block = TREE_BLOCK (COND_EXPR_ELSE (entry));
     }
 
   /* We do not need the gotos anymore.  */
@@ -843,7 +845,8 @@ make_goto_expr_edges (basic_block bb)
 #else
       e->goto_locus = EXPR_LOCUS (goto_t);
 #endif
-      e->goto_block = TREE_BLOCK (goto_t);
+      if (e->goto_locus)
+	e->goto_block = TREE_BLOCK (goto_t);
       bsi_remove (&last, true);
       return;
     }

gcc43-pr29609-3.patch:

--- NEW FILE gcc43-pr29609-3.patch ---
--- gcc/cfglayout.c.jj	2008-10-07 21:35:33.000000000 +0200
+++ gcc/cfglayout.c	2008-10-09 11:18:51.000000000 +0200
@@ -448,13 +448,12 @@ change_scope (rtx orig_insn, tree s1, tr
     }
 }
 
-/* Return lexical scope block insn belong to.  */
+/* Return lexical scope block locator belongs to.  */
 static tree
-insn_scope (const_rtx insn)
+locator_scope (int loc)
 {
   int max = VEC_length (int, block_locators_locs);
   int min = 0;
-  int loc = INSN_LOCATOR (insn);
 
   /* When block_locators_locs was initialized, the pro- and epilogue
      insns didn't exist yet and can therefore not be found this way.
@@ -488,6 +487,13 @@ insn_scope (const_rtx insn)
   return VEC_index (tree, block_locators_blocks, min);
 }
 
+/* Return lexical scope block insn belongs to.  */
+static tree
+insn_scope (const_rtx insn)
+{
+  return locator_scope (INSN_LOCATOR (insn));
+}
+
 /* Return line number of the statement specified by the locator.  */
 static location_t
 locator_location (int loc)
@@ -551,6 +557,17 @@ insn_file (const_rtx insn)
   return locator_file (INSN_LOCATOR (insn));
 }
 
+/* Return true if LOC1 and LOC2 locators have the same location and scope.  */
+bool
+locator_eq (int loc1, int loc2)
+{
+  if (loc1 == loc2)
+    return true;
+  if (locator_location (loc1) != locator_location (loc2))
+    return false;
+  return locator_scope (loc1) == locator_scope (loc2);
+}
+
 /* Rebuild all the NOTE_INSN_BLOCK_BEG and NOTE_INSN_BLOCK_END notes based
    on the scope tree and the newly reordered instructions.  */
 
@@ -901,24 +918,30 @@ fixup_reorder_chain (void)
 	  if (e->goto_locus && !(e->flags & EDGE_ABNORMAL))
 	    {
 	      basic_block nb;
+	      rtx end;
 
-	      if (simplejump_p (BB_END (e->src)))
+	      insn = BB_END (e->src);
+	      end = PREV_INSN (BB_HEAD (e->src));
+	      while (insn != end
+		     && (!INSN_P (insn) || INSN_LOCATOR (insn) == 0))
+		insn = PREV_INSN (insn);
+	      if (insn != end
+		  && locator_eq (INSN_LOCATOR (insn), (int) e->goto_locus))
+		continue;
+	      if (simplejump_p (BB_END (e->src))
+		  && INSN_LOCATOR (BB_END (e->src)) == 0)
 		{
-		  if (INSN_LOCATOR (BB_END (e->src)) == (int) e->goto_locus)
-		    continue;
-		  if (INSN_LOCATOR (BB_END (e->src)) == 0)
-		    {
-		      INSN_LOCATOR (BB_END (e->src)) = e->goto_locus;
-		      continue;
-		    }
+		  INSN_LOCATOR (BB_END (e->src)) = e->goto_locus;
+		  continue;
 		}
 	      if (e->dest != EXIT_BLOCK_PTR)
 		{
 		  insn = BB_HEAD (e->dest);
-		  if (!INSN_P (insn))
-		    insn = next_insn (insn);
-		  if (insn && INSN_P (insn)
-		      && INSN_LOCATOR (insn) == (int) e->goto_locus)
+		  end = NEXT_INSN (BB_END (e->dest));
+		  while (insn != end && !INSN_P (insn))
+		    insn = NEXT_INSN (insn);
+		  if (insn != end && INSN_LOCATOR (insn)
+		      && locator_eq (INSN_LOCATOR (insn), (int) e->goto_locus))
 		    continue;
 		}
 	      nb = split_edge (e);
--- gcc/rtl.h.jj	2008-10-07 21:25:44.000000000 +0200
+++ gcc/rtl.h	2008-10-09 11:15:57.000000000 +0200
@@ -1622,6 +1622,7 @@ extern int insn_line (const_rtx);
 extern const char * insn_file (const_rtx);
 extern int locator_line (int);
 extern const char * locator_file (int);
+extern bool locator_eq (int, int);
 extern int prologue_locator, epilogue_locator;
 
 /* In jump.c */
--- gcc/cfgrtl.c.jj	2008-10-07 21:35:33.000000000 +0200
+++ gcc/cfgrtl.c	2008-10-09 10:37:03.000000000 +0200
@@ -2623,19 +2623,21 @@ cfg_layout_merge_blocks (basic_block a, 
      some unique locus, emit a nop with that locus in between.  */
   if (!optimize && EDGE_SUCC (a, 0)->goto_locus)
     {
-      rtx insn = BB_END (a);
+      rtx insn = BB_END (a), end = PREV_INSN (BB_HEAD (a));
       int goto_locus = EDGE_SUCC (a, 0)->goto_locus;
 
-      if (NOTE_P (insn))
-	insn = prev_nonnote_insn (insn);
-      if (insn && INSN_P (insn) && INSN_LOCATOR (insn) == goto_locus)
+      while (insn != end && (!INSN_P (insn) || INSN_LOCATOR (insn) == 0))
+	insn = PREV_INSN (insn);
+      if (insn != end && locator_eq (INSN_LOCATOR (insn), goto_locus))
 	goto_locus = 0;
       else
 	{
 	  insn = BB_HEAD (b);
-	  if (!INSN_P (insn))
-	    insn = next_insn (insn);
-	  if (insn && INSN_P (insn) && INSN_LOCATOR (insn) == goto_locus)
+	  end = NEXT_INSN (BB_END (b));
+	  while (insn != end && !INSN_P (insn))
+	    insn = NEXT_INSN (insn);
+	  if (insn != end && INSN_LOCATOR (insn) != 0
+	      && locator_eq (INSN_LOCATOR (insn), goto_locus))
 	    goto_locus = 0;
 	}
       if (goto_locus)
--- gcc/cfgcleanup.c.jj	2008-10-07 21:35:33.000000000 +0200
+++ gcc/cfgcleanup.c	2008-10-09 11:07:40.000000000 +0200
@@ -482,7 +482,7 @@ try_forward_edges (int mode, basic_block
 		     blocks with different locus are not optimized out.  */
 		  int locus = single_succ_edge (target)->goto_locus;
 
-		  if (locus && goto_locus && locus != goto_locus)
+		  if (locus && goto_locus && !locator_eq (locus, goto_locus))
 		    counter = n_basic_blocks;
 		  else if (locus)
 		    goto_locus = locus;
@@ -491,7 +491,8 @@ try_forward_edges (int mode, basic_block
 		    {
 		      locus = INSN_LOCATOR (BB_END (target));
 
-		      if (locus && goto_locus && locus != goto_locus)
+		      if (locus && goto_locus
+			  && !locator_eq (locus, goto_locus))
 			counter = n_basic_blocks;
 		      else if (locus)
 			goto_locus = locus;


Index: gcc43.spec
===================================================================
RCS file: /cvs/pkgs/rpms/gcc/devel/gcc43.spec,v
retrieving revision 1.45
retrieving revision 1.46
diff -u -r1.45 -r1.46
--- gcc43.spec	8 Oct 2008 13:12:55 -0000	1.45
+++ gcc43.spec	9 Oct 2008 10:24:52 -0000	1.46
@@ -3,7 +3,7 @@
 %define gcc_version 4.3.2
 # Note, gcc_release must be integer, if you want to add suffixes to
 # %{release}, append them after %{gcc_release} on Release: line.
-%define gcc_release 5
+%define gcc_release 6
 %define _unpackaged_files_terminate_build 0
 %define multilib_64_archs sparc64 ppc64 s390x x86_64
 %define include_gappletviewer 1
@@ -159,6 +159,8 @@
 Patch23: gcc43-pr37738.patch
 Patch24: gcc43-pr29609.patch
 Patch25: gcc43-aes.patch
+Patch26: gcc43-pr29609-2.patch
+Patch27: gcc43-pr29609-3.patch
 
 # On ARM EABI systems, we do want -gnueabi to be part of the
 # target triple.
@@ -468,6 +470,8 @@
 %patch23 -p0 -b .pr37738~
 %patch24 -p0 -b .pr29609~
 %patch25 -p0 -b .aes~
+%patch26 -p0 -b .pr29609-2~
+%patch26 -p0 -b .pr29609-3~
 
 tar xzf %{SOURCE4}
 
@@ -1717,6 +1721,9 @@
 %doc rpm.doc/changelogs/libmudflap/ChangeLog*
 
 %changelog
+* Thu Oct  9 2008 Jakub Jelinek <jakub at redhat.com> 4.3.2-6
+- fix fallouts from the -g -O0 debugging patch (#466169, #466198)
+
 * Wed Oct  8 2008 Jakub Jelinek <jakub at redhat.com> 4.3.2-5
 - update from gcc-4_3-branch
   - PRs c++/37555, c/35712, c/37645, fortran/35770, fortran/35945,




More information about the scm-commits mailing list