This is the mail archive of the gcc-patches@gcc.gnu.org mailing list for the GCC project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

[gfortran] Fix breakage


Patch below fexes some of the breakage introduced by the last merge.

Applied to tree-ssa branch.

Paul

2003-10-05  Paul Brook  <paul@nowt.org>

	* f95-lang.c (expand_function_body): Call (push|pop)_function_context.
	* trans-decl.c (gfc_generate_function_code): Set
	cfun->function_end_locus.

diff -urpxCVS clean/tree-ssa/gcc/fortran/f95-lang.c gcc/gcc/fortran/
f95-lang.c
--- clean/tree-ssa/gcc/fortran/f95-lang.c
+++ gcc/gcc/fortran/f95-lang.c
@@ -200,10 +200,16 @@ tree *ridpointers = NULL;
 void
 expand_function_body (tree fndecl, int nested)
 {
+  if (nested)
+    push_function_context ();
+
   if (!flag_disable_gimple)
     gimplify_function_tree (fndecl);
 
   tree_rest_of_compilation (fndecl, nested);
+
+  if (nested)
+    pop_function_context ();
 }
 
 
diff -urpxCVS clean/tree-ssa/gcc/fortran/trans-decl.c gcc/gcc/fortran/
trans-decl.c
--- clean/tree-ssa/gcc/fortran/trans-decl.c
+++ gcc/gcc/fortran/trans-decl.c
@@ -1935,19 +1935,24 @@ gfc_generate_function_code (gfc_namespac
   /* Output the SIMPLE tree.  */
   dump_function (TDI_original, fndecl);
 
+  /* Store the end of the function, so that we get good line number
+     info for the epilogue.  */
+  cfun->function_end_locus = input_location;
+
   /* We're leaving the context of this function, so zap cfun.  It's still 
in
      DECL_SAVED_INSNS, and we'll restore it in tree_rest_of_compilation.  
*/
   cfun = NULL;
 
-  /* RTL generation.  */
-  if (!old_context)
-    expand_function_body (fndecl, 0);
-
   if (old_context)
     {
       pop_function_context ();
       saved_function_decls = saved_parent_function_decls;
     }
+  else
+    {
+      /* Pass the function to the backend.  */
+      expand_function_body (fndecl, 0);
+    }
 
   current_function_decl = old_context;
 }


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]