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 gcc.c-torture/compile/20030716-1.c


This tree-checking failure,

gcc.c-torture/compile/20030716-1.c:6: internal compiler error: tree check:
expected class 'd', have '2' (plus_expr) in store_parm_decls, at c-decl.c:5986

is not fixed by any of 

2003-07-16  Daniel Berlin  <dberlin@dberlin.org>

        * c-decl.c (store_parm_decls): Also strip NON_LVALUE_EXPRs and
        CONVERT_EXPRs when setting DECL_NONLOCAL.

2003-07-03  Jeff Law  <law@redhat.com>

        * c-decl.c (store_parm_decls): Strip away NOP_EXPRs when looking
        for hidden use variables.

2003-06-24  Jeff Law  <law@redhat.com>

        * c-decl.c (store_parm_decls): Variables and parameters on the
        pending_sizes chain have nonlocal uses.

Fourth time's a charm, right?  ;-)


r~


	* c-decl.c (set_decl_nonlocal): New.
	(store_parm_decls): Use it via walk_tree.

Index: c-decl.c
===================================================================
RCS file: /cvs/gcc/gcc/gcc/c-decl.c,v
retrieving revision 1.334.2.65
diff -c -p -d -r1.334.2.65 c-decl.c
*** c-decl.c	30 Sep 2003 21:21:16 -0000	1.334.2.65
--- c-decl.c	1 Oct 2003 21:20:33 -0000
*************** store_parm_decls_oldstyle (void)
*** 5920,5925 ****
--- 5920,5944 ----
      }
  }
  
+ /* A subroutine of store_parm_decls called via walk_tree.  Mark all
+    decls non-local.  */
+ 
+ static tree
+ set_decl_nonlocal (tree *tp, int *walk_subtrees, void *data ATTRIBUTE_UNUSED)
+ {
+   tree t = *tp;
+ 
+   if (DECL_P (t))
+     {
+       DECL_NONLOCAL (t) = 1;
+       *walk_subtrees = 0;
+     }
+   else if (TYPE_P (t))
+     *walk_subtrees = 0;
+ 
+   return NULL;
+ }
+ 
  /* Store the parameter declarations into the current function declaration.
     This is called after parsing the parameter declarations, before
     digesting the body of the function.
*************** store_parm_decls (void)
*** 5972,5989 ****
  	   t;
  	   t = TREE_CHAIN (t))
  	{
! 	  /* We will have a nonlocal use of this variable.  */
! 	  tree var = TREE_OPERAND (TREE_VALUE (t), 0);
! 
! 	  /* Strip away any NOP_EXPRs, NON_LVALUE_EXPRs and CONVERT_EXPRs.
! 	     STRIP_NOPS is not sufficient here since the nodes may have
! 	     different modes.  */
! 	  while (TREE_CODE (var) == NOP_EXPR
! 		 || TREE_CODE (var) == NON_LVALUE_EXPR
! 		 || TREE_CODE (var) == CONVERT_EXPR)
! 	    var = TREE_OPERAND (var, 0);
  
- 	  DECL_NONLOCAL (var) = 1;
  	  SAVE_EXPR_CONTEXT (TREE_VALUE (t)) = context;
  	}
      }
--- 5991,6001 ----
  	   t;
  	   t = TREE_CHAIN (t))
  	{
! 	  /* We will have a nonlocal use of whatever variables are
! 	     buried inside here.  */
! 	  walk_tree (&TREE_OPERAND (TREE_VALUE (t), 0),
! 		     set_decl_nonlocal, NULL, NULL);
  
  	  SAVE_EXPR_CONTEXT (TREE_VALUE (t)) = context;
  	}
      }


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