java/2216: gcj generates bad bytecode
tromey@redhat.com
tromey@redhat.com
Wed Mar 7 15:36:00 GMT 2001
>Number: 2216
>Category: java
>Synopsis: gcj generates bad bytecode
>Confidential: no
>Severity: serious
>Priority: medium
>Responsible: unassigned
>State: open
>Class: sw-bug
>Submitter-Id: net
>Arrival-Date: Wed Mar 07 15:36:00 PST 2001
>Closed-Date:
>Last-Modified:
>Originator: Tom Tromey
>Release: current head cvs
>Organization:
>Environment:
>Description:
If I compile the appended program with
`gcj -C', Sun's `java' interpreter gives
a VerificationError. This probably means that the
generated bytecode are incorrect.
import java.io.*;
import java.net.*;
public class GetURL {
public static void main(String[] args) throws Exception {
InputStream in = null;
OutputStream out = null;
try {
if (!(args.length == 1 || args.length == 2))
throw new IllegalArgumentException("Wrong number of args");
URL url = new URL(args[0]);
in = url.openStream();
if (args.length == 2)
out = new FileOutputStream(args[1]);
else
out = System.out;
byte[] buffer = new byte[4096];
int bytes_read;
while ((bytes_read = in.read(buffer)) != -1)
out.write(buffer, 0, bytes_read);
}
catch (Exception e) {
System.err.println(e);
}
finally {
in.close();
out.close();
}
}
}
>How-To-Repeat:
>Fix:
>Release-Note:
>Audit-Trail:
>Unformatted:
More information about the Gcc-bugs
mailing list