This is the mail archive of the gcc-bugs@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]

Re: Can't compile egcs...


This is caused by a bug in cp/decl.c, where it would deallocate memory
it still needed. Please try the patch below.

Regards,
Martin

Thu Apr 16 09:36:37 1998  Martin von Loewis  <loewis@informatik.hu-berlin.de>

	* decl.c (duplicate_decls): Do not deallocate memory we don't own.

Index: decl.c
===================================================================
RCS file: /egcs/carton/cvsfiles/egcs/gcc/cp/decl.c,v
retrieving revision 1.92
diff -u -r1.92 decl.c
--- decl.c	1998/04/13 11:13:36	1.92
+++ decl.c	1998/04/16 07:35:27
@@ -3088,9 +3088,14 @@
 	      TREE_VALUE (decls) = olddecl;
 	}
 
-      if ((char *)newdecl + ROUND (function_size)
-	  + ROUND (sizeof (struct lang_decl))
-	  == obstack_next_free (&permanent_obstack))
+      /* Only deallocate newdecl if lang_decl immediately
+	 follows newdecl, and next_free immediately follows
+	 permanent_obstack.  */
+      if (((char *)newdecl + ROUND (function_size) 
+	   == (char*) DECL_LANG_SPECIFIC (newdecl))
+	  && (((char*) DECL_LANG_SPECIFIC (newdecl) 
+	       + ROUND (sizeof (struct lang_decl)))
+	      == obstack_next_free (&permanent_obstack)))
 	{
 	  DECL_MAIN_VARIANT (newdecl) = olddecl;
 	  DECL_LANG_SPECIFIC (olddecl) = ol;


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