Patchwork [Fortran] PR60447 - Stop generating *.s file with -E -cpp

login
register
mail settings
Submitter Tobias Burnus
Date March 8, 2014, 1:44 p.m.
Message ID <531B1EB0.8080609@net-b.de>
Download mbox | patch
Permalink /patch/328192/
State New
Headers show

Comments

Tobias Burnus - March 8, 2014, 1:44 p.m.
Hello,

gfortran currently tells the ME that it wants it - even if it is not 
needed when only preprocessing a file (-E). This patch fixes this by 
telling the ME that no_backend is required - and then by triggering an 
early exit in lang_dependent_init (all in toplev.c).

Build and currently regtesting.
OK for the trunk?

Tobias
Steve Kargl - March 8, 2014, 5:55 p.m.
On Sat, Mar 08, 2014 at 02:44:16PM +0100, Tobias Burnus wrote:
> 
> gfortran currently tells the ME that it wants it - even if it is not 
> needed when only preprocessing a file (-E). This patch fixes this by 
> telling the ME that no_backend is required - and then by triggering an 
> early exit in lang_dependent_init (all in toplev.c).
> 
> Build and currently regtesting.
> OK for the trunk?
> 

Yes.

Patch

2014-03-08  Tobias Burnus  <burnus@net-b.de>

	PR fortran/60447
	* f95-lang.c (gfc_init): Return false when only
	preprocessing.
	* options.c (gfc_post_options): Ditto.

diff --git a/gcc/fortran/f95-lang.c b/gcc/fortran/f95-lang.c
index aa49ea0..e25e92a 100644
--- a/gcc/fortran/f95-lang.c
+++ b/gcc/fortran/f95-lang.c
@@ -223,6 +223,9 @@  gfc_init (void)
   if (!gfc_new_file ())
     fatal_error ("can't open input file: %s", gfc_source_file);
 
+  if (flag_preprocess_only)
+    return false;
+
   return true;
 }
 
diff --git a/gcc/fortran/options.c b/gcc/fortran/options.c
index 895a7dc..a2b91ca 100644
--- a/gcc/fortran/options.c
+++ b/gcc/fortran/options.c
@@ -437,14 +437,7 @@  gfc_post_options (const char **pfilename)
 
   gfc_cpp_post_options ();
 
-/* FIXME: return gfc_cpp_preprocess_only ();
-
-   The return value of this function indicates whether the
-   backend needs to be initialized. On -E, we don't need
-   the backend. However, if we return 'true' here, an
-   ICE occurs. Initializing the backend doesn't hurt much,
-   hence, for now we can live with it as is.  */
-  return false;
+  return gfc_cpp_preprocess_only ();
 }