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]
Other format: [Raw text]

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


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);


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