toplev.c: set FILE * globals to NULL after fclose
authorDavid Malcolm <dmalcolm@redhat.com>
Wed, 10 Aug 2016 13:08:13 +0000 (13:08 +0000)
committerDavid Malcolm <dmalcolm@gcc.gnu.org>
Wed, 10 Aug 2016 13:08:13 +0000 (13:08 +0000)
gcc/ChangeLog:
* toplev.c (finalize): Set aux_info_file, asm_out_file, and
stack_usage_file to NULL after fclose calls.

From-SVN: r239322

gcc/ChangeLog
gcc/toplev.c

index 17fa9faa002b2106c6f6003fbb949fb81c86b76e..cc23c1559b69e909c73a0ce01223c059829caac9 100644 (file)
@@ -1,3 +1,8 @@
+2016-08-10  David Malcolm  <dmalcolm@redhat.com>
+
+       * toplev.c (finalize): Set aux_info_file, asm_out_file, and
+       stack_usage_file to NULL after fclose calls.
+
 2016-08-10  Senthil Kumar Selvaraj  <senthil_kumar.selvaraj@atmel.com>
 
        PR target/71873
index b0bb3ecd309bfa076817d7305197d4dd1cf88630..ddaee8a55c157506a609fd5c47be06e93cdbb3eb 100644 (file)
@@ -1894,6 +1894,7 @@ finalize (bool no_backend)
   if (flag_gen_aux_info)
     {
       fclose (aux_info_file);
+      aux_info_file = NULL;
       if (seen_error ())
        unlink (aux_info_file_name);
     }
@@ -1908,10 +1909,14 @@ finalize (bool no_backend)
        fatal_error (input_location, "error writing to %s: %m", asm_file_name);
       if (fclose (asm_out_file) != 0)
        fatal_error (input_location, "error closing %s: %m", asm_file_name);
+      asm_out_file = NULL;
     }
 
   if (stack_usage_file)
-    fclose (stack_usage_file);
+    {
+      fclose (stack_usage_file);
+      stack_usage_file = NULL;
+    }
 
   if (!no_backend)
     {