for gcc/ChangeLog
from  Alexandre Oliva  <aoliva@redhat.com>

	PR debug/46338
	* profile.c (branch_prob): Skip debug stmts for BB end locus.

Index: gcc/profile.c
===================================================================
--- gcc/profile.c.orig	2010-11-22 20:05:55.558067049 -0200
+++ gcc/profile.c	2010-11-23 23:31:07.309901035 -0200
@@ -937,10 +937,11 @@ branch_prob (void)
 	  /* It may happen that there are compiler generated statements
 	     without a locus at all.  Go through the basic block from the
 	     last to the first statement looking for a locus.  */
-	  for (gsi = gsi_last_bb (bb); !gsi_end_p (gsi); gsi_prev (&gsi))
+	  for (gsi = gsi_last_bb (bb); !gsi_end_p (gsi);
+	       gsi_prev (&gsi))
 	    {
 	      last = gsi_stmt (gsi);
-	      if (gimple_has_location (last))
+	      if (!is_gimple_debug (last) && gimple_has_location (last))
 		break;
 	    }
 
