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

Re: Class file generated by "gcj -C" throws ClassFormatError


Tom Tromey <tromey@redhat.com> writes:

> I've also noticed that `gcj --syntax-only foo.class' does not give an
> error here.  I think it ought to.  I often run `gcj --syntax-only' on
> a .class file to do checking; for instance it is an easy way to check
> that the output of `gcj -C' is sensible.

Here is a patch to fix this.  Since this causes bootstrapping to fail
(AWTEvent.class contaisn the error), I don't think I'll check it in
quite yet ...

Index: class.c
===================================================================
RCS file: /cvs/gcc/gcc/gcc/java/class.c,v
retrieving revision 1.99
diff -u -p -r1.99 class.c
--- class.c	2001/06/21 03:20:04	1.99
+++ class.c	2001/06/25 22:36:16
@@ -751,6 +751,12 @@ set_constant_value (field, constant)
   else
     {
       DECL_INITIAL (field) = constant;
+      if (TREE_TYPE (constant) != TREE_TYPE (field)
+	  && ! (TREE_TYPE (constant) == int_type_node
+		&& INTEGRAL_TYPE_P (TREE_TYPE (field))
+		&& TYPE_PRECISION (TREE_TYPE (field)) <= 32))
+	error ("ConstantValue attribute of field '%s' has wrong type",
+	       IDENTIFIER_POINTER (DECL_NAME (field)));
       if (FIELD_FINAL (field))
 	DECL_FIELD_FINAL_IUD (field) = 1;
     }

-- 
	--Per Bothner
per@bothner.com   http://www.bothner.com/per/


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