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]

[tree-ssa] fix fortran debugging


For some reason, gimplification of Fortran source is leaving most
of the program variables in a nested BLOCK, like so:

	MAIN__()
	{
	  {
	    int4 x;
	  }
	}

and that nested BLOCK is associated with the outermost BIND_EXPR.
If we discard that BIND_EXPR immediately in lower_function_body,
then we discard basically all of the function's variables.

I didn't bother to find out why this was happening.  The code in
lower_function_body just seemed asymmetric.

Bootstrapped and tested on i686-linux.


r~


        * gimple-low.c (lower_function_body): Call lower_bind_expr
        to handle the outermost BIND_EXPR.

Index: gimple-low.c
===================================================================
RCS file: /cvs/gcc/gcc/gcc/Attic/gimple-low.c,v
retrieving revision 1.1.4.13
diff -u -p -r1.1.4.13 gimple-low.c
--- gimple-low.c	16 Nov 2003 23:00:59 -0000	1.1.4.13
+++ gimple-low.c	28 Nov 2003 03:13:47 -0000
@@ -55,11 +55,13 @@ static bool expand_var_p (tree);
 
 /* Lowers the BODY.  */
 void
-lower_function_body (tree *body)
+lower_function_body (tree *body_p)
 {
   struct lower_data data;
+  tree bind = *body_p;
+  tree_stmt_iterator i;
 
-  if (TREE_CODE (*body) != BIND_EXPR)
+  if (TREE_CODE (bind) != BIND_EXPR)
     abort ();
 
   data.block = DECL_INITIAL (current_function_decl);
@@ -67,9 +69,10 @@ lower_function_body (tree *body)
   BLOCK_CHAIN (data.block) = NULL_TREE;
   TREE_ASM_WRITTEN (data.block) = 1;
 
-  record_vars (BIND_EXPR_VARS (*body));
-  *body = BIND_EXPR_BODY (*body);
-  lower_stmt_body (*body, &data);
+  *body_p = alloc_stmt_list ();
+  i = tsi_start (*body_p);
+  tsi_link_after (&i, bind, TSI_NEW_STMT);
+  lower_bind_expr (&i, &data);
 
   if (data.block != DECL_INITIAL (current_function_decl))
     abort ();


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