From 92c66d8311bb83157dbbf0008f750e12761d5296 Mon Sep 17 00:00:00 2001 From: =?utf8?q?Manuel=20L=C3=B3pez-Ib=C3=A1=C3=B1ez?= Date: Wed, 19 Nov 2014 18:11:54 +0000 Subject: [PATCH] re PR driver/36312 (should refuse to overwrite input file with output file) 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 From-SVN: r217789 --- gcc/ChangeLog | 9 +++++++++ gcc/gcc.c | 4 +++- gcc/toplev.c | 3 ++- 3 files changed, 14 insertions(+), 2 deletions(-) diff --git a/gcc/ChangeLog b/gcc/ChangeLog index 791599fca4f..15010a091a8 100644 --- a/gcc/ChangeLog +++ b/gcc/ChangeLog @@ -1,3 +1,12 @@ +2014-11-19 Manuel López-Ibáñez + Jakub Jelinek + + 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 Merger of git branch "gimple-classes-v2-option-3". diff --git a/gcc/gcc.c b/gcc/gcc.c index 653ca8db9f6..c6d1baf58df 100644 --- 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++) diff --git a/gcc/toplev.c b/gcc/toplev.c index 2e480471d6b..86c4b81b3ae 100644 --- a/gcc/toplev.c +++ b/gcc/toplev.c @@ -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 -- 2.30.2