This is the mail archive of the java-patches@gcc.gnu.org mailing list for the Java 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]

[gcjx] Patch: FYI: handle deleted variables


I'm checking this in on the gcjx branch.

If a variable was completely deleted by the optimizer, we could crash
when its start location became NULL.  This patch avoids the crash.

This happened when building libgcj.jar with the default options.  Now
we can build all of libgcj.jar with -g without having to intervene
manually.

Tom

Index: ChangeLog
from  Tom Tromey  <tromey@redhat.com>
	* bytecode/locals.cc (emit): Handle case where variable is
	optimized away.
	(update): Likewise.

Index: bytecode/locals.cc
===================================================================
RCS file: /cvs/gcc/gcc/gcjx/bytecode/Attic/locals.cc,v
retrieving revision 1.1.2.8
diff -u -r1.1.2.8 locals.cc
--- bytecode/locals.cc 18 May 2005 00:21:35 -0000 1.1.2.8
+++ bytecode/locals.cc 13 Sep 2005 00:27:24 -0000
@@ -164,7 +164,9 @@
       debug_info &info (*i);
 
       info.start = info.start->update ();
-      if (info.start->live_p ())
+      // Note that we can wind up with NULL here if a variable is
+      // completely optimized away.
+      if (info.start != NULL && info.start->live_p ())
 	{
 	  info.end = info.end->update ();
 	  // NULL is ok here since that just means it is live through
@@ -207,7 +209,8 @@
        ++i)
     {
       debug_info &info (*i);
-      if (! info.start->live_p () || info.start == info.end)
+      if (info.start == NULL || ! info.start->live_p ()
+	  || info.start == info.end)
 	continue;
 
       model_type *t = info.variable->type ();
@@ -235,7 +238,8 @@
        ++i)
     {
       const debug_info &info (*i);
-      if (! info.start->live_p () || info.start == info.end)
+      if (info.start == NULL || ! info.start->live_p ()
+	  || info.start == info.end)
 	continue;
 
       model_type *t = info.variable->type ();


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