From 56a98848ccf12d3d1c525dc5793a6cd206be9a30 Mon Sep 17 00:00:00 2001
From: tromey <tromey@138bc75d-0d04-0410-961f-82ee72b054a4>
Date: Wed, 30 Mar 2005 17:46:48 +0000
Subject: [PATCH] 	* jcf-dump.c (HANDLE_INNERCLASSES_ATTRIBUTE): Handle
 cases where 	inner_class_info_index==0 or outer_class_info_index==0.

git-svn-id: svn+ssh://gcc.gnu.org/svn/gcc/trunk@97263 138bc75d-0d04-0410-961f-82ee72b054a4
---
 gcc/java/ChangeLog  |  5 +++++
 gcc/java/jcf-dump.c | 22 +++++++++++++++-------
 2 files changed, 20 insertions(+), 7 deletions(-)

diff --git a/gcc/java/ChangeLog b/gcc/java/ChangeLog
index 0c0430ec6b1..73233aab9a8 100644
--- a/gcc/java/ChangeLog
+++ b/gcc/java/ChangeLog
@@ -1,3 +1,8 @@
+2005-03-30  Tom Tromey  <tromey@redhat.com>
+
+	* jcf-dump.c (HANDLE_INNERCLASSES_ATTRIBUTE): Handle cases where
+	inner_class_info_index==0 or outer_class_info_index==0.
+
 2005-03-29  Tom Tromey  <tromey@redhat.com>
 
 	* gcj.texi (libgcj Runtime Properties): Document
diff --git a/gcc/java/jcf-dump.c b/gcc/java/jcf-dump.c
index c3fd9f1bf4d..9bd7650b661 100644
--- a/gcc/java/jcf-dump.c
+++ b/gcc/java/jcf-dump.c
@@ -65,7 +65,7 @@ The Free Software Foundation is independent of Sun Microsystems, Inc.  */
 #include <getopt.h>
 #include <math.h>
 
-/* Outout file. */
+/* Output file. */
 FILE *out;
 /* Name of output file, if NULL if stdout. */
 char *output_file = NULL;
@@ -320,8 +320,12 @@ utf8_equal_string (JCF *jcf, int index, const char * value)
       if (flag_print_class_info)					    \
 	{								    \
 	  fprintf (out, "\n  inner: ");					    \
-	  print_constant_terse_with_index (out, jcf,			    \
-				inner_class_info_index, CONSTANT_Class);    \
+	  if (inner_class_info_index == 0)				    \
+	    fprintf (out, " (no inner info index)");			    \
+	  else								    \
+	    print_constant_terse_with_index (out, jcf,			    \
+					     inner_class_info_index,	    \
+					     CONSTANT_Class);		    \
 	  if (inner_name_index == 0)					    \
 	    fprintf (out, " (anonymous)");				    \
 	  else if (verbose || flag_print_constant_pool)			    \
@@ -334,12 +338,16 @@ utf8_equal_string (JCF *jcf, int index, const char * value)
 	  fprintf (out, ", access flags: 0x%x", inner_class_access_flags);  \
 	  print_access_flags (out, inner_class_access_flags, 'c');	    \
 	  fprintf (out, ", outer class: ");				    \
-	  print_constant_terse_with_index (out, jcf,			    \
-				outer_class_info_index, CONSTANT_Class);    \
+	  if (outer_class_info_index == 0)				    \
+	    fprintf (out, "(not a member)");				    \
+	  else								    \
+	    print_constant_terse_with_index (out, jcf,			    \
+					     outer_class_info_index,	    \
+					     CONSTANT_Class);		    \
 	}								    \
     }									    \
-      if (flag_print_class_info)					    \
-	fputc ('\n', out);						    \
+  if (flag_print_class_info)						    \
+    fputc ('\n', out);							    \
 }
 
 #define HANDLE_SOURCEDEBUGEXTENSION_ATTRIBUTE(LENGTH) \
-- 
GitLab