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]

PR java/17779: ICE: Seg fault


This happens in the case of recursive dependencies when we call
layout_type() when a superclass is still being laid out.  This happens
with a combination of inner classes and recursive dependencies.  We
really need to redesign the way class dependency processing is done so
that we read all classes and then lay them all out later, but this is
something of a redesign effort.

What follows is something of a kludge, but it has the advantage of
only being triggered in one particular case.

Andrew.


2004-10-05  Andrew Haley  <aph@redhat.com>

	PR java/17779
	* jcf-parse.c (parse_zip_file_entries): If a class has a
	superclass and a TYPE_SIZE of zero, lay it out.

Index: jcf-parse.c
===================================================================
RCS file: /cvs/gcc/gcc/gcc/java/jcf-parse.c,v
retrieving revision 1.172
diff -p -2 -c -r1.172 jcf-parse.c
*** jcf-parse.c	28 Sep 2004 17:40:56 -0000	1.172
--- jcf-parse.c	5 Oct 2004 14:12:48 -0000
*************** parse_zip_file_entries (void)
*** 1232,1235 ****
--- 1241,1257 ----
  	    output_class = current_class = class;
  
+ 	    /* This is for a corner case where we have a superclass
+ 	       but no superclass fields.  
+ 
+ 	       This can happen if we earlier failed to lay out this
+ 	       class because its superclass was still in the process
+ 	       of being laid out; this occurs when we have recursive
+ 	       class dependencies via inner classes.  Setting
+ 	       TYPE_SIZE to null here causes CLASS_LOADED_P to return
+ 	       false, so layout_class() will be called again.  */
+ 	    if (TYPE_SIZE (class) && CLASSTYPE_SUPER (class)
+ 		&& integer_zerop (TYPE_SIZE (class)))
+ 	      TYPE_SIZE (class) = NULL_TREE;
+ 
  	    if (! CLASS_LOADED_P (class))
  	      {


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