Bug 21020 - java.lang.NoSuchFieldError regression from earlier 4.0.0 snapshot
Summary: java.lang.NoSuchFieldError regression from earlier 4.0.0 snapshot
Status: RESOLVED FIXED
Alias: None
Product: gcc
Classification: Unclassified
Component: libgcj (show other bugs)
Version: 4.0.0
: P2 normal
Target Milestone: 4.0.0
Assignee: Tom Tromey
URL:
Keywords:
Depends on:
Blocks:
 
Reported: 2005-04-14 12:06 UTC by Caolan McNamara
Modified: 2005-04-26 20:51 UTC (History)
3 users (show)

See Also:
Host:
Target:
Build:
Known to work:
Known to fail:
Last reconfirmed: 2005-04-14 13:20:55


Attachments
sample source (484 bytes, text/x-c++src)
2005-04-14 12:07 UTC, Caolan McNamara
Details
sample jar (179.10 KB, application/x-jar)
2005-04-14 12:07 UTC, Caolan McNamara
Details

Note You need to log in before you can comment on or make changes to this bug.
Description Caolan McNamara 2005-04-14 12:06:05 UTC
java.lang.NoSuchFieldError
   at .__gxx_personality_v0 (/home/caolan/java/a.out)
   at .__gxx_personality_v0 (/home/caolan/java/a.out)
   at .__gxx_personality_v0 (/home/caolan/java/a.out)
   at .__libc_start_main (/lib/libc-2.3.4.so)
   at .__gxx_personality_v0 (/home/caolan/java/a.out)
Comment 1 Caolan McNamara 2005-04-14 12:07:05 UTC
Created attachment 8628 [details]
sample source
Comment 2 Caolan McNamara 2005-04-14 12:07:58 UTC
Created attachment 8629 [details]
sample jar
Comment 3 Caolan McNamara 2005-04-14 12:09:01 UTC
version of failing gcj

gcc (GCC) 4.0.0 20050412 (Red Hat 4.0.0-0.42)
Copyright (C) 2005 Free Software Foundation, Inc.
This is free software; see the source for copying conditions.  There is NO
warranty; not even for MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
Comment 4 Caolan McNamara 2005-04-14 12:09:40 UTC
version of successful gcj

gcc (GCC) 4.0.0 20050405 (Red Hat 4.0.0-0.40)
Copyright (C) 2005 Free Software Foundation, Inc.
This is free software; see the source for copying conditions.  There is NO
warranty; not even for MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
Comment 5 Caolan McNamara 2005-04-14 12:11:05 UTC
affects db-4.2 as well for what it's worth
Comment 6 Mark Wielaard 2005-04-14 13:20:53 UTC
With 4.1 (20050412) I get:
g++ -g -lgcj java.cxx 
./a.out
java.lang.ClassNotFoundException: Lcom.sun.star.uno.Type;
   <<No stacktrace available>>

4.0 (20050413) indeed throws java.lang.NoSuchFieldError
Comment 8 Tom Tromey 2005-04-14 18:05:59 UTC
For 4.0, my recent system class loader patch works around this problem.

The attached patch should go in the trunk asap.
I looked at all other users of _Jv_FindClassFromSignature,
and this was the only problem caller.
Comment 9 Andrew Haley 2005-04-14 18:47:58 UTC
Do you want me to post the patch, then?
Comment 10 Mark Wielaard 2005-04-14 19:14:27 UTC
This was "fixed" by the following patch on the 4.0 branch (20050414):

2005-04-14  Tom Tromey  <tromey@redhat.com>

        * java/lang/natClassLoader.cc (_Jv_FindClass): Use system loader,
        not boot loader.
        (_Jv_RegisterInitiatingLoader): Likewise.
        (_Jv_UnregisterInitiatingLoader): Likewise.
Comment 11 Tom Tromey 2005-04-26 20:51:30 UTC
This was worked around for 4.0.
I'm checking in Andrew's patch for the trunk.
Comment 12 GCC Commits 2005-04-26 20:52:57 UTC
Subject: Bug 21020

CVSROOT:	/cvs/gcc
Module name:	gcc
Changes by:	tromey@gcc.gnu.org	2005-04-26 20:52:35

Modified files:
	libjava        : ChangeLog jni.cc 

Log message:
	2005-04-26  Andrew Haley  <aph@redhat.com>
	
	PR libgcj/21020:
	* jni.cc (_Jv_JNI_GetAnyFieldID): Use class' loader to find
	field's type.

Patches:
http://gcc.gnu.org/cgi-bin/cvsweb.cgi/gcc/libjava/ChangeLog.diff?cvsroot=gcc&r1=1.3557&r2=1.3558
http://gcc.gnu.org/cgi-bin/cvsweb.cgi/gcc/libjava/jni.cc.diff?cvsroot=gcc&r1=1.97&r2=1.98

Comment 13 GCC Commits 2005-08-24 18:05:07 UTC
Subject: Bug 21020

CVSROOT:	/cvs/gcc
Module name:	gcc
Branch: 	gcc-4_0-branch
Changes by:	tromey@gcc.gnu.org	2005-08-24 18:04:56

Modified files:
	libjava        : ChangeLog jni.cc 

Log message:
	2005-04-26  Andrew Haley  <aph@redhat.com>
	
	PR libgcj/21020:
	* jni.cc (_Jv_JNI_GetAnyFieldID): Use class' loader to find
	field's type.

Patches:
http://gcc.gnu.org/cgi-bin/cvsweb.cgi/gcc/libjava/ChangeLog.diff?cvsroot=gcc&only_with_tag=gcc-4_0-branch&r1=1.3391.2.93&r2=1.3391.2.94
http://gcc.gnu.org/cgi-bin/cvsweb.cgi/gcc/libjava/jni.cc.diff?cvsroot=gcc&only_with_tag=gcc-4_0-branch&r1=1.95&r2=1.95.2.1