re PR lto/77305 (-fdump-tree-all and -flto causes ICE)
authorRichard Biener <rguenther@suse.de>
Tue, 23 Aug 2016 07:21:36 +0000 (07:21 +0000)
committerRichard Biener <rguenth@gcc.gnu.org>
Tue, 23 Aug 2016 07:21:36 +0000 (07:21 +0000)
2016-08-23  Richard Biener  <rguenther@suse.de>

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

From-SVN: r239683

gcc/ChangeLog
gcc/statistics.c

index b9798f1a5f98ad6b5828e934b86434a6f8cbe4ae..42fe573338adbb34dbc2b1be8297f103abb0d538 100644 (file)
@@ -1,3 +1,9 @@
+2016-08-23  Richard Biener  <rguenther@suse.de>
+
+       PR middle-end/77305
+       * statistics.c (statistics_counter_event): Robustify against
+       NULL current_pass.
+
 2016-08-23  Venkataramanan Kumar
 
        * config/i386/i386.c (processor_alias_table): Enable PTA_PRFCHW
index 24ee28e8ec0d7b4e77765675c129554929f83d8e..ec5cefd4baa4562b5df85c7d75e709874362bdd3 100644 (file)
@@ -312,7 +312,8 @@ statistics_counter_event (struct function *fn, const char *id, int incr)
       || 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 function *fn, const char *id, int incr)
 
   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);