re PR driver/36312 (should refuse to overwrite input file with output file)
authorManuel López-Ibáñez <manu@gcc.gnu.org>
Wed, 19 Nov 2014 18:11:54 +0000 (18:11 +0000)
committerJakub Jelinek <jakub@gcc.gnu.org>
Wed, 19 Nov 2014 18:11:54 +0000 (19:11 +0100)
PR driver/36312
PR driver/63837
* gcc.c (process_command): Don't check for input/output
filename equality if output is HOST_BIT_BUCKET.
* toplev.c (init_asm_output): Likewise.

Co-Authored-By: Jakub Jelinek <jakub@redhat.com>
From-SVN: r217789

gcc/ChangeLog
gcc/gcc.c
gcc/toplev.c

index 791599fca4fa6c88b67b9df18eb8191ab15b83c2..15010a091a814f180a9c88baeb5f5da1889a42dd 100644 (file)
@@ -1,3 +1,12 @@
+2014-11-19  Manuel López-Ibáñez  <manu@gcc.gnu.org>
+           Jakub Jelinek  <jakub@redhat.com>
+
+       PR driver/36312
+       PR driver/63837
+       * gcc.c (process_command): Don't check for input/output
+       filename equality if output is HOST_BIT_BUCKET.
+       * toplev.c (init_asm_output): Likewise.
+
 2014-11-19  David Malcolm  <dmalcolm@redhat.com>
 
        Merger of git branch "gimple-classes-v2-option-3".
index 653ca8db9f61e1818f5ec6db77fb0e9c5119c218..c6d1baf58dfeeffbc8c36f3245958e6ad0921598 100644 (file)
--- a/gcc/gcc.c
+++ b/gcc/gcc.c
@@ -4155,7 +4155,9 @@ process_command (unsigned int decoded_options_count,
                           CL_DRIVER, &handlers, global_dc);
     }
 
-  if (output_file && strcmp (output_file, "-"))
+  if (output_file
+      && strcmp (output_file, "-") != 0
+      && strcmp (output_file, HOST_BIT_BUCKET) != 0)
     {
       int i;
       for (i = 0; i < n_infiles; i++)
index 2e480471d6b3e2d22c135adfc833e8518aa45c1b..86c4b81b3aeefd6793cf9dbef03f3961a59411ed 100644 (file)
@@ -945,7 +945,8 @@ init_asm_output (const char *name)
        }
       if (!strcmp (asm_file_name, "-"))
        asm_out_file = stdout;
-      else if (!canonical_filename_eq (asm_file_name, name))
+      else if (!canonical_filename_eq (asm_file_name, name)
+              || !strcmp (asm_file_name, HOST_BIT_BUCKET))
        asm_out_file = fopen (asm_file_name, "w");
       else
        /* Use fatal_error (UNKOWN_LOCATION) instead of just fatal_error to