This is the mail archive of the 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: fix crash in profiling

As the comment explains.  Approved offline by Honza.  Bootstrapped on

2004-11-15 Dale Johannesen <>

* profile.c (compute_branch_probabilities): Prevent
crash with EH in RTL-based profiling.

Index: profile.c
RCS file: /cvs/gcc/gcc/gcc/profile.c,v
retrieving revision 1.151
diff -u -d -b -w -p -r1.151 profile.c
--- profile.c 16 Nov 2004 00:08:00 -0000 1.151
+++ profile.c 16 Nov 2004 01:21:23 -0000
@@ -569,10 +569,13 @@ compute_branch_probabilities (void)
/* Otherwise try to preserve the existing REG_BR_PROB probabilities
- tree based profile guessing put into code. */
+ tree based profile guessing put into code. BB can be the
+ ENTRY_BLOCK, and it can have multiple (fake) successors in
+ EH cases, but it still has no code; don't crash in this case. */
else if (profile_status == PROFILE_ABSENT
&& !ir_type ()
&& EDGE_COUNT (bb->succs) > 1
+ && BB_END (bb)
&& (note = find_reg_note (BB_END (bb), REG_BR_PROB, 0)))
int prob = INTVAL (XEXP (note, 0));

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