This is the mail archive of the
java-prs@sourceware.cygnus.com
mailing list for the Java project.
gcj/83: Failure to compile try/finally?
- To: java-gnats at sourceware dot cygnus dot com
- Subject: gcj/83: Failure to compile try/finally?
- From: gback at cs dot utah dot edu
- Date: 4 Nov 1999 16:21:01 -0000
- Reply-To: gback at cs dot utah dot edu
- Resent-Cc: java-prs at sourceware dot cygnus dot com, green at cygnus dot com
- Resent-Reply-To: java-gnats@sourceware.cygnus.com, gback@cs.utah.edu
>Number: 83
>Category: gcj
>Synopsis: Failure to compile try/finally?
>Confidential: no
>Severity: serious
>Priority: medium
>Responsible: apbianco
>State: open
>Class: sw-bug
>Submitter-Id: net
>Arrival-Date: Thu Nov 04 08:30:00 PST 1999
>Closed-Date:
>Last-Modified:
>Originator: Godmar Back
>Release: CVS October
>Organization:
>Environment:
Linux
>Description:
An old problem I've mentioned in April still hasn't been
fixed.
The following program produces incorrect results when
compiled from the java source.
It works when compiled from a .class file generated by
say jikes.
Sun's JDK executes the .class file generated by gcj -C.
gcj cannot compile the .class file it generates with -C.
>How-To-Repeat:
/*
* test that caught null pointers exceptions in finalizers work correctly
* and that local variables are accessible in null pointer exception handlers.
*/
import java.io.*;
public class NullPointerTest {
static String s;
public static void main(String[] args) {
System.out.println(tryfinally() + s);
}
public static String tryfinally() {
String yuck = null;
String local_s = null;
try {
return "This is ";
} finally {
try {
local_s = "Perfect";
/* trigger null pointer exception */
String x = yuck.toLowerCase();
} catch (Exception _) {
/*
* when the null pointer exception is caught, we must still
* be able to access local_s.
* Our return address for the finally clause must also still
* be intact.
*/
s = local_s;
}
}
}
}
/* Expected Output:
This is Perfect
*/
>Fix:
N/A
>Release-Note:
>Audit-Trail:
>Unformatted: