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]

(C++) Patch for typedef redeclaration


When a typedef was redeclared, we would use common_type to combine the
two types, which would strip the special typedef _TYPE node, confusing
the dwarf2 debugging backend.

2000-07-25  Jason Merrill  <jason@redhat.com>

	* dwarf2out.c (gen_typedef_die): Abort if we get identical
	TREE_TYPE and DECL_ORIGINAL_TYPE on a typedef.

2000-07-25  Jason Merrill  <jason@redhat.com>

	* typeck.c (common_type): If we're just returning one of our
	arguments, don't strip typedef types.

Index: dwarf2out.c
===================================================================
RCS file: /cvs/gcc/egcs/gcc/dwarf2out.c,v
retrieving revision 1.188
diff -c -p -r1.188 dwarf2out.c
*** dwarf2out.c	2000/07/24 17:52:37	1.188
--- dwarf2out.c	2000/07/27 17:35:36
*************** gen_typedef_die (decl, context_die)
*** 9275,9281 ****
        if (DECL_ORIGINAL_TYPE (decl))
  	{
  	  type = DECL_ORIGINAL_TYPE (decl);
! 	  equate_type_number_to_die (TREE_TYPE (decl), type_die);
  	}
        else
  	type = TREE_TYPE (decl);
--- 9275,9285 ----
        if (DECL_ORIGINAL_TYPE (decl))
  	{
  	  type = DECL_ORIGINAL_TYPE (decl);
! 
! 	  if (type == TREE_TYPE (decl))
! 	    abort ();
! 	  else
! 	    equate_type_number_to_die (TREE_TYPE (decl), type_die);
  	}
        else
  	type = TREE_TYPE (decl);
Index: cp/typeck.c
===================================================================
RCS file: /cvs/gcc/egcs/gcc/cp/typeck.c,v
retrieving revision 1.300
diff -c -p -r1.300 typeck.c
*** cp/typeck.c	2000/07/25 20:19:24	1.300
--- cp/typeck.c	2000/07/27 17:35:41
*************** composite_pointer_type (t1, t2, arg1, ar
*** 521,546 ****
     converted to integer types.  */
  
  tree
! common_type (t1, t2)
!      tree t1, t2;
  {
    register enum tree_code code1;
    register enum tree_code code2;
    tree attributes;
  
    /* Save time if the two types are the same.  */
    if (t1 == t2)
!     return t1;
!   t1 = original_type (t1);
!   t2 = original_type (t2);
!   if (t1 == t2)
!     return t1;
  
    /* If one type is nonsense, use the other.  */
    if (t1 == error_mark_node)
!     return t2;
    if (t2 == error_mark_node)
!     return t1;
  
    if ((ARITHMETIC_TYPE_P (t1) || TREE_CODE (t1) == ENUMERAL_TYPE)
        && (ARITHMETIC_TYPE_P (t2) || TREE_CODE (t2) == ENUMERAL_TYPE))
--- 521,547 ----
     converted to integer types.  */
  
  tree
! common_type (orig_t1, orig_t2)
!      tree orig_t1, orig_t2;
  {
    register enum tree_code code1;
    register enum tree_code code2;
    tree attributes;
+   tree t1, t2;
  
    /* Save time if the two types are the same.  */
+   if (orig_t1 == orig_t2)
+     return orig_t1;
+   t1 = original_type (orig_t1);
+   t2 = original_type (orig_t2);
    if (t1 == t2)
!     return orig_t1;
  
    /* If one type is nonsense, use the other.  */
    if (t1 == error_mark_node)
!     return orig_t2;
    if (t2 == error_mark_node)
!     return orig_t1;
  
    if ((ARITHMETIC_TYPE_P (t1) || TREE_CODE (t1) == ENUMERAL_TYPE)
        && (ARITHMETIC_TYPE_P (t2) || TREE_CODE (t2) == ENUMERAL_TYPE))

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