This is the mail archive of the gcc-bugs@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: c/6815: [3.2/3.3 regression] ICE with longjmp if -fprofile-arcs -O is specified


On Thu, Dec 12, 2002 at 01:37:26PM +0100, Christian Ehrhardt wrote:
> where e is NULL. insert_insn_on_edge in turn is called from
> flow_call_edges_add in cfganal.c:325 with this piece of code:
> 
> | for (e = bb->succ; e; e = e->succ_next)
> |   if (e->dest == EXIT_BLOCK_PTR)
> |     break;
> |
> | insert_insn_on_edge (gen_rtx_USE (VOIDmode, const0_rtx), e);
> | commit_edge_insertions ();
> 
> which looks a bit strange if we keep in mind that insert_insn_on_edge
> will crash if the second parameter is NULL.

Indeed, this piece of code cannot handle a noreturn function
in the last block.  The following should fix it.


r~



Index: cfganal.c
===================================================================
RCS file: /cvs/gcc/gcc/gcc/cfganal.c,v
retrieving revision 1.30
diff -c -p -d -u -r1.30 cfganal.c
--- cfganal.c	11 Oct 2002 21:09:59 -0000	1.30
+++ cfganal.c	12 Dec 2002 18:07:41 -0000
@@ -320,10 +320,11 @@ flow_call_edges_add (blocks)
 
 	  for (e = bb->succ; e; e = e->succ_next)
 	    if (e->dest == EXIT_BLOCK_PTR)
-	      break;
-
-	  insert_insn_on_edge (gen_rtx_USE (VOIDmode, const0_rtx), e);
-	  commit_edge_insertions ();
+	      {
+		insert_insn_on_edge (gen_rtx_USE (VOIDmode, const0_rtx), e);
+		commit_edge_insertions ();
+		break;
+	      }
 	}
     }
 


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