C++ PATCH: Fix mainling vbase4.C test failures

Mark Mitchell mark@codesourcery.com
Thu Oct 31 08:09:00 GMT 2002


On PowerPC, and some other failures, an assert that I added recently
was failing.  This was a good thing in that the reason it was failing
was that we were actually trying to use the same piece of storage for
two different things; DECL_NUM_STMTS and THUNK_DELTA.  In some
configurations, that didn't matter; we never actually use them both at
once.  In other cases, we do.

Tested on i686-pc-linux-gnu, and with a cross compiler to a PowerPC;
installed on the mainline.

-- 
Mark Mitchell                   mark@codesourcery.com
CodeSourcery, LLC               http://www.codesourcery.com

2002-10-31  Mark Mitchell  <mark@codesourcery.com>

	* cp-tree.h (lang_decl_flags): Remove init_priority.
	(lang_decl): Add delta.
	(GLOBAL_INIT_PRIORITY): Remove.
	(THUNK_DELTA): Revise definition.
	* decl2.c (start_objects): Don't set GLOBAL_INIT_PRIORITY.
	* dump.c (cp_dump_tree): Don't dump it.

Index: cp-tree.h
===================================================================
RCS file: /cvs/gcc/gcc/gcc/cp/cp-tree.h,v
retrieving revision 1.766
diff -c -p -r1.766 cp-tree.h
*** cp-tree.h	30 Oct 2002 15:54:06 -0000	1.766
--- cp-tree.h	31 Oct 2002 16:06:07 -0000
*************** struct lang_decl_flags GTY(())
*** 1747,1756 ****
      /* For VAR_DECL in function, this is DECL_DISCRIMINATOR.  */
      int discriminator;
  
-     /* In a namespace-scope FUNCTION_DECL, this is
-        GLOBAL_INIT_PRIORITY.  */
-     int init_priority;
- 
      /* In a FUNCTION_DECL for which DECL_THUNK_P holds, this is
         THUNK_VCALL_OFFSET.  */
      tree GTY((tag ("2"))) vcall_offset;
--- 1747,1752 ----
*************** struct lang_decl GTY(())
*** 1775,1780 ****
--- 1771,1780 ----
  	/* In a FUNCTION_DECL, this is DECL_CLONED_FUNCTION.  */
  	tree cloned_function;
  	
+ 	/* In a FUNCTION_DECL for which THUNK_P holds, this is
+ 	   THUNK_DELTA.  */
+ 	HOST_WIDE_INT delta;
+ 
  	/* In an overloaded operator, this is the value of
  	   DECL_OVERLOADED_OPERATOR_P.  */
  	enum tree_code operator_code;
*************** struct lang_decl GTY(())
*** 2689,2701 ****
  #define DECL_GLOBAL_DTOR_P(NODE) \
    (DECL_LANG_SPECIFIC (NODE)->decl_flags.global_dtor_p)
  
- /* If DECL_GLOBAL_CTOR_P or DECL_GLOBAL_DTOR_P holds, this macro
-    returns the initialization priority for the function.  Constructors
-    with lower numbers should be run first.  Destructors should be run
-    in the reverse order of constructors.  */
- #define GLOBAL_INIT_PRIORITY(NODE) \
-   (LANG_DECL_U2_CHECK (NODE, 1)->init_priority)
- 
  /* Accessor macros for C++ template decl nodes.  */
  
  /* The DECL_TEMPLATE_PARMS are a list.  The TREE_PURPOSE of each node
--- 2689,2694 ----
*************** struct lang_decl GTY(())
*** 2935,2941 ****
  
  /* An integer indicating how many bytes should be subtracted from the
     `this' pointer when this function is called.  */
! #define THUNK_DELTA(DECL) (DECL_CHECK (DECL)->decl.u1.i)
  
  /* A tree indicating how many bytes should be subtracted from the
     vtable for the `this' pointer to find the vcall offset.  (The vptr
--- 2928,2935 ----
  
  /* An integer indicating how many bytes should be subtracted from the
     `this' pointer when this function is called.  */
! #define THUNK_DELTA(DECL) \
!   (DECL_LANG_SPECIFIC (DECL)->u.f.delta)
  
  /* A tree indicating how many bytes should be subtracted from the
     vtable for the `this' pointer to find the vcall offset.  (The vptr
Index: decl2.c
===================================================================
RCS file: /cvs/gcc/gcc/gcc/cp/decl2.c,v
retrieving revision 1.568
diff -c -p -r1.568 decl2.c
*** decl2.c	11 Oct 2002 16:50:41 -0000	1.568
--- decl2.c	31 Oct 2002 16:06:08 -0000
*************** start_objects (method_type, initp)
*** 2144,2150 ****
    else
      DECL_GLOBAL_DTOR_P (current_function_decl) = 1;
    DECL_LANG_SPECIFIC (current_function_decl)->decl_flags.u2sel = 1;
-   GLOBAL_INIT_PRIORITY (current_function_decl) = initp;
  
    body = begin_compound_stmt (/*has_no_scope=*/0);
  
--- 2144,2149 ----
Index: dump.c
===================================================================
RCS file: /cvs/gcc/gcc/gcc/cp/dump.c,v
retrieving revision 1.63
diff -c -p -r1.63 dump.c
*** dump.c	26 Jul 2002 13:45:38 -0000	1.63
--- dump.c	31 Oct 2002 16:06:08 -0000
*************** cp_dump_tree (dump_info, t)
*** 323,329 ****
  		dump_string (di, "global init");
  	      if (DECL_GLOBAL_DTOR_P (t))
  		dump_string (di, "global fini");
- 	      dump_int (di, "prio", GLOBAL_INIT_PRIORITY (t));
  	    }
  	  if (DECL_FRIEND_PSEUDO_TEMPLATE_INSTANTIATION (t))
  	    dump_string (di, "pseudo tmpl");
--- 323,328 ----



More information about the Gcc-patches mailing list