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

Benja Fallenstein b.fallenstein@gmx.de
Thu Mar 13 08:12:02 2003


Sorry, I forgot to include my version information.

> benja@joy:/tmp$ /usr/local/kaffe/bin/java -version 
> Kaffe Virtual Machine
...
> Engine: Just-in-time v3   Version: 1.1.x-cvs   Java Version: 1.1

I'm running on x86.

Thx,
- Benja


Benja Fallenstein wrote:
> 
> 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
> 
>