[Bug fortran/60447] Empty .s file created when using -E flag

sgk at troutmask dot apl.washington.edu gcc-bugzilla@gcc.gnu.org
Thu Mar 6 17:08:00 GMT 2014


http://gcc.gnu.org/bugzilla/show_bug.cgi?id=60447

--- Comment #6 from Steve Kargl <sgk at troutmask dot apl.washington.edu> ---
On Thu, Mar 06, 2014 at 03:01:52PM +0000, sgk at troutmask dot
apl.washington.edu wrote:
> http://gcc.gnu.org/bugzilla/show_bug.cgi?id=60447
> 
> --- Comment #5 from Steve Kargl <sgk at troutmask dot apl.washington.edu> ---
> On Thu, Mar 06, 2014 at 02:45:38PM +0000, vladimir.fuka at gmail dot com wrote:
> >
> > I see, but I just wanted to print the content or pipe it somewhere,
> > so I don't think that resolves it.
> > 
> 
> I did not say that it resolves the problem (as I obviously
> did not close the PR).  I'm showing you a way to eliminate
> the spurious *.s file if it really bothers you.

Possible patch.

Index: cpp.c
===================================================================
--- cpp.c    (revision 207633)
+++ cpp.c    (working copy)
@@ -536,16 +536,13 @@ gfc_cpp_init_0 (void)

   if (gfc_cpp_preprocess_only ())
     {
+      /* If only cpp is desired, then a hack is needed to redirect assembler
+     output (actually nothing as -E implies -fsyntax-only) to another
+     file, otherwise the output from preprocessing is lost.  */
+      asm_file_name = gfc_cpp_option.temporary_filename;
+
       if (gfc_cpp_option.output_filename)
     {
-      /* This needs cheating: with "-E -o <file>", the user wants the
-         preprocessed output in <file>. However, if nothing is done
-         about it <file> is also used for assembler output. Hence, it
-         is necessary to redirect assembler output (actually nothing
-         as -E implies -fsyntax-only) to another file, otherwise the
-         output from preprocessing is lost.  */
-      asm_file_name = gfc_cpp_option.temporary_filename;
-
       print.outf = fopen (gfc_cpp_option.output_filename, "w");
       if (print.outf == NULL)
         gfc_fatal_error ("opening output file %s: %s",



More information about the Gcc-bugs mailing list