diff mbox

Fix PR77305

Message ID alpine.LSU.2.11.1608221148020.26629@t29.fhfr.qr
State New
Headers show

Commit Message

Richard Biener Aug. 22, 2016, 9:48 a.m. UTC
The following robustifies statsistics accounting against current_pass
being NULL.

Bootstrap running on x86_64-unknown-linux-gnu.

Richard.

2016-08-22  Richard Biener  <rguenther@suse.de>

	PR middle-end/77305
	* statistics.c (statistics_counter_event): Robustify against
	NULL current_pass.
diff mbox

Patch

Index: gcc/statistics.c
===================================================================
--- gcc/statistics.c	(revision 239653)
+++ gcc/statistics.c	(working copy)
@@ -312,7 +312,8 @@  statistics_counter_event (struct functio
       || incr == 0)
     return;
 
-  if (current_pass->static_pass_number != -1)
+  if (current_pass
+      && current_pass->static_pass_number != -1)
     {
       counter = lookup_or_add_counter (curr_statistics_hash (), id, 0, false);
       gcc_assert (!counter->histogram_p);
@@ -325,8 +326,8 @@  statistics_counter_event (struct functio
 
   fprintf (statistics_dump_file,
 	   "%d %s \"%s\" \"%s\" %d\n",
-	   current_pass->static_pass_number,
-	   current_pass->name,
+	   current_pass ? current_pass->static_pass_number : -1,
+	   current_pass ? current_pass->name : "none",
 	   id,
 	   function_name (fn),
 	   incr);