gcj buglet

Tom Tromey tromey@redhat.com
Tue Oct 2 05:31:00 GMT 2001


Consider this program:
 public class t
 {
 public static String s (int x)
 {
	return null;
 }
 public static void main (String[] args)
 {
	System.out.println ((s(0) + "") == null);
 }
 }
This erroneously prints `true'.
It ought to print `false'.
I believe the empty-string elimination code in parse.y is somehow
buggy (but I am not 100% certain). When I look at the assembly code
for this, there are no calls to StringBuffer from main.
In this particular case it would be ok to replace the StringBuffer
stuff with a single call to String.valueOf().
Tom


More information about the Java mailing list

AltStyle によって変換されたページ (->オリジナル) /