[kaffe] [Bug in CVS version] (-1)/2 == -1 sometimes

Benja Fallenstein b.fallenstein@gmx.de
Thu Mar 13 08:09:01 2003


Hi all,

With a current CVS version of Kaffe (compiled yesterday), the following 
program, compiled with Sun javac or kjc--

---------------------------------------------
public class Foo {
     static int fn(int n) {
	return (n-1)/2;
     }

     public static void main(String[] s) {
	System.out.println((0-1)/2);
	System.out.println(fn(0));
     }
}
---------------------------------------------

gives me this output:

> benja@joy:/tmp$ /usr/local/kaffe/bin/java -cp . Foo
> 0
> -1

Sun's java 1.4 gives two zeros as expected.

Sorry if this is a dupe, I haven't followed the mailing list closely.

Thanks,
- Benja