public inbox for java-patches@gcc.gnu.org
 help / color / mirror / Atom feed
* [Patch] Fix ICE with java and -freduced-reflection.
@ 2008-08-21  0:16 David Daney
  2008-08-21 12:15 ` Tom Tromey
  0 siblings, 1 reply; 2+ messages in thread
From: David Daney @ 2008-08-21  0:16 UTC (permalink / raw)
  To: Java Patch List, gcc-patches

[-- Attachment #1: Type: text/plain, Size: 846 bytes --]

When compiling certain java programs (like libgcj) with freduced-reflection, jc1 will ICE with SIGSEGV.

The cause is a small logic error in make_class_data(tree).  We allocate a VEC of length zero with VEC_alloc(int, heap, 0) which returns NULL, but then try to add an element with VEC_quick_push() resulting in SIGSEGV as the VEC is NULL.  We should only be adding the field indexes if they are static or (uses_jv_markobj || !flag_reduced_reflection), but we unconditionally fall through and always add something.

The fix is to continue the loop if the conditions for field inclusion are not met and not add the bogus index.

Currently bootstrapping/testing on i686-pc-linux-gnu.

OK to commit if it passes?


2008-08-20  David Daney  <ddaney@avtrex.com>

	* class.c (make_class_data): Don't add field_index when
	flag_reduced_reflection set.

[-- Attachment #2: class.patch --]
[-- Type: text/x-patch, Size: 412 bytes --]

Index: class.c
===================================================================
--- class.c	(revision 139335)
+++ class.c	(working copy)
@@ -1821,6 +1821,8 @@ make_class_data (tree type)
 	    field_index = static_count++;
 	  else if (uses_jv_markobj || !flag_reduced_reflection)
 	    field_index = instance_count++;
+	  else
+	    continue;
 	  VEC_quick_push (int, field_indexes, field_index);
 	}
     }

^ permalink raw reply	[flat|nested] 2+ messages in thread

* Re: [Patch] Fix ICE with java and -freduced-reflection.
  2008-08-21  0:16 [Patch] Fix ICE with java and -freduced-reflection David Daney
@ 2008-08-21 12:15 ` Tom Tromey
  0 siblings, 0 replies; 2+ messages in thread
From: Tom Tromey @ 2008-08-21 12:15 UTC (permalink / raw)
  To: David Daney; +Cc: Java Patch List, gcc-patches

>>>>> "David" == David Daney <ddaney@avtrex.com> writes:

David> The fix is to continue the loop if the conditions for field
David> inclusion are not met and not add the bogus index.

David> OK to commit if it passes?

Ok.  Thanks.

Tom

^ permalink raw reply	[flat|nested] 2+ messages in thread

end of thread, other threads:[~2008-08-21  0:16 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2008-08-21  0:16 [Patch] Fix ICE with java and -freduced-reflection David Daney
2008-08-21 12:15 ` Tom Tromey

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).