This is the mail archive of the
java-prs@sourceware.cygnus.com
mailing list for the Java project.
gcj/85: Compiler optimizes away private methods when native methods might access them
- To: java-gnats at sourceware dot cygnus dot com
- Subject: gcj/85: Compiler optimizes away private methods when native methods might access them
- From: bryce at albatross dot co dot nz
- Date: 5 Nov 1999 02:34:36 -0000
- Reply-To: bryce at albatross dot co dot nz
- Resent-Cc: java-prs at sourceware dot cygnus dot com, green at cygnus dot com
- Resent-Reply-To: java-gnats@sourceware.cygnus.com, bryce@albatross.co.nz
>Number: 85
>Category: gcj
>Synopsis: Compiler optimizes away private methods when native methods might access them
>Confidential: no
>Severity: serious
>Priority: medium
>Responsible: apbianco
>State: open
>Class: sw-bug
>Submitter-Id: net
>Arrival-Date: Thu Nov 04 18:40:00 PST 1999
>Closed-Date:
>Last-Modified:
>Originator: Bryce McKinlay <bryce@albatross.co.nz>
>Release: 19991104
>Organization:
>Environment:
linux
>Description:
When attempting to compile libgcj with optimization (-O2),
native methods which attempt to access certain private
static methods fail to link.
For example:
.libs/libgcj.so: undefined reference to
`java::net::InetAddress::checkConnect(java::lang::String *)'
>How-To-Repeat:
The following test code also demonstrates the problem. It
works ok without optimization, but with -O it fails to link:
// java
public class A
{
public static void main(String args[])
{
new A();
}
public A()
{
a();
}
native void a();
private void b()
{
System.out.println("ok");
}
}
// c++
#include <gcj/cni.h>
#include "A.h"
void A::a()
{
b();
}
>Fix:
gcj should not optimize away private methods when native
methods exist in the class.
>Release-Note:
>Audit-Trail:
>Unformatted: