gcj/85: Compiler optimizes away private methods when native methods might access them
bryce@albatross.co.nz
bryce@albatross.co.nz
Thu Nov 4 18:40:00 GMT 1999
>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:
More information about the Java-prs
mailing list