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]

[patch] Prevent ICE in flow_loop_dump


flow_loop_dump assumes that loop->first->head and loop->last->end
are set.  This is not true in the case of tree flowgraphs.

OK to commit to trunk?

Diego.


	* flow.c (flow_loop_dump): Do not display insn UIDs if
	the basic blocks in the loop contain no RTL instructions.

Index: flow.c
===================================================================
RCS file: /cvs/gcc/gcc/gcc/flow.c,v
retrieving revision 1.471
diff -d -p -d -u -p -r1.471 flow.c
--- flow.c	2001/08/23 15:33:12	1.471
+++ flow.c	2001/08/27 03:42:23
@@ -9176,11 +9176,17 @@ flow_loop_dump (loop, file, loop_dump_au
   if (! loop || ! loop->header)
     return;
 
-  fprintf (file, ";;\n;; Loop %d (%d to %d):%s%s\n",
-	   loop->num, INSN_UID (loop->first->head),
-	   INSN_UID (loop->last->end),
-	   loop->shared ? " shared" : "",
-	   loop->invalid ? " invalid" : "");
+  if (loop->first->head && loop->last->end)
+    fprintf (file, ";;\n;; Loop %d (%d to %d):%s%s\n",
+	    loop->num, INSN_UID (loop->first->head),
+	    INSN_UID (loop->last->end),
+	    loop->shared ? " shared" : "",
+	    loop->invalid ? " invalid" : "");
+  else
+    fprintf (file, ";;\n;; Loop %d:%s%s\n", loop->num,
+	     loop->shared ? " shared" : "",
+	     loop->invalid ? " invalid" : "");
+
   fprintf (file, ";;  header %d, latch %d, pre-header %d, first %d, last %d\n",
 	   loop->header->index, loop->latch->index,
 	   loop->pre_header ? loop->pre_header->index : -1,


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