[patch] tree-cfg.c: Make sure that EDGE_COUNT of COND_EXPR is two.

Kazu Hirata kazu@cs.umass.edu
Wed Nov 3 22:21:00 GMT 2004


Hi,

Attached is a patch to have tree_verify_flow_info catch any COND_EXPR
with the number of its edges not being two.

Actually, just above this "if" stateemnt in the patch, we have a call
to extract_true_false_edges_from_block, which expects exactly two
edges, so we are very likely to crash there before we even get to the
"if" statement if we have less than two edges.  In any case, it's good
to be exact.

Tested on i686-pc-linux-gnu.  OK to apply?

Kazu Hirata

2004-11-03  Kazu Hirata  <kazu@cs.umass.edu>

	* tree-cfg.c (tree_verify_flow_info): Make sure that
	EDGE_COUNT of COND_EXPR is two.

Index: tree-cfg.c
===================================================================
RCS file: /cvs/gcc/gcc/gcc/tree-cfg.c,v
retrieving revision 2.98
diff -u -d -p -r2.98 tree-cfg.c
--- tree-cfg.c	3 Nov 2004 01:40:56 -0000	2.98
+++ tree-cfg.c	3 Nov 2004 01:56:33 -0000
@@ -3492,7 +3492,7 @@ tree_verify_flow_info (void)
 		|| !(false_edge->flags & EDGE_FALSE_VALUE)
 		|| (true_edge->flags & (EDGE_FALLTHRU | EDGE_ABNORMAL))
 		|| (false_edge->flags & (EDGE_FALLTHRU | EDGE_ABNORMAL))
-		|| EDGE_COUNT (bb->succs) >= 3)
+		|| EDGE_COUNT (bb->succs) != 2)
 	      {
 		error ("Wrong outgoing edge flags at end of bb %d\n",
 		       bb->index);



More information about the Gcc-patches mailing list