This is the mail archive of the
java-patches@gcc.gnu.org
mailing list for the Java project.
Patch: FYI: special case Object.<init> in verifier
- From: Tom Tromey <tromey at redhat dot com>
- To: Java Patch List <java-patches at gcc dot gnu dot org>
- Cc: Gcc Patch List <gcc-patches at gcc dot gnu dot org>
- Date: 16 May 2006 15:59:27 -0600
- Subject: Patch: FYI: special case Object.<init> in verifier
- Reply-to: tromey at redhat dot com
I'm checking this in.
We need a special case for Object.<init> in the verifier. Normally
we must check that the superclass <init> was called on 'this' in a
constructor; however, for Object this is impossible.
This bug only occurs if you try to build Object from its class file.
I happened to do this recently.
Tom
Index: ChangeLog
from Tom Tromey <tromey@redhat.com>
* verify-impl.c (verify_instructions_0) <op_return>: Special case
for Object.<init>.
Index: verify-impl.c
===================================================================
--- verify-impl.c (revision 112917)
+++ verify-impl.c (working copy)
@@ -1,4 +1,4 @@
-/* Copyright (C) 2001, 2002, 2003, 2004, 2005 Free Software Foundation
+/* Copyright (C) 2001, 2002, 2003, 2004, 2005, 2006 Free Software Foundation
This file is part of libgcj.
@@ -2887,9 +2887,11 @@
invalidate_pc ();
break;
case op_return:
- /* We only need to check this when the return type is
- void, because all instance initializers return void. */
- if (this_is_init)
+ /* We only need to check this when the return type is void,
+ because all instance initializers return void. We also
+ need to special-case Object constructors, as they can't
+ call a superclass <init>. */
+ if (this_is_init && vfr->current_class != vfy_object_type ())
state_check_this_initialized (vfr->current_state);
check_return_type (make_type (void_type));
invalidate_pc ();