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]

tree.c (build_type_attribute_variant): Move current_obstack restore...


I have checked in this patch.

This fixes a winsup (cygwin) build failure reported by Chris Faylor.

cc1plus accidentally allocated an entry for the type_hash_table on a
non-permanent obstack.  It was later freed, replaced with garbage, and then
the next dereference triggered a core dump.

Thu Jul 15 15:40:09 1999  Jim Wilson  <wilson@cygnus.com>

	* tree.c (build_type_attribute_variant): Move current_obstack restore
	after build_qualified_type call.

Index: tree.c
===================================================================
RCS file: /cvs/cvsfiles/devo/gcc/tree.c,v
retrieving revision 1.176
diff -p -r1.176 tree.c
*** tree.c	1999/05/11 01:48:08	1.176
--- tree.c	1999/07/15 20:36:42
*************** build_type_attribute_variant (ttype, att
*** 3376,3382 ****
          current_obstack = TYPE_OBSTACK (ttype);
  
        ntype = copy_node (ttype);
-       current_obstack = ambient_obstack;
  
        TYPE_POINTER_TO (ntype) = 0;
        TYPE_REFERENCE_TO (ntype) = 0;
--- 3376,3381 ----
*************** build_type_attribute_variant (ttype, att
*** 3411,3416 ****
--- 3410,3421 ----
  
        ntype = type_hash_canon (hashcode, ntype);
        ttype = build_qualified_type (ntype, TYPE_QUALS (ttype));
+ 
+       /* We must restore the current obstack after the type_hash_canon call,
+ 	 because type_hash_canon calls type_hash_add for permanent types, and
+ 	 then type_hash_add calls oballoc expecting to get something permanent
+ 	 back.  */
+       current_obstack = ambient_obstack;
      }
  
    return ttype;


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