Is this a bug?

Martin Kahlert martin.kahlert@infineon.com
Wed Sep 4 22:57:00 GMT 2002


On Wed, Sep 04, 2002 at 10:04:31AM -0600, tromey@redhat.com wrote:
> >>>>> "Martin" == Martin Kahlert <martin.kahlert@infineon.com> writes:
> 
> Martin>     final static long a = 1000000000;
> Martin>     final static long b = 1000 * a;
> 
> This looks like a front-end bug in gcj -- the bug persists if you use
> `gcj -C'.  Could you file a PR for this?

Did that: 
java/7833: Problem multiplying int and long when int is too small for result

Another funny thing:
public class hello
{
    final static long a = 1000000000;
    final static long b = 1000 * a;
    final static long c = 1000L * a;

    public static void main(String[] args)
    {
        System.out.println("a = " + a);
        System.out.println("b = " + b);
        System.out.println("c = " + c);
    }
}

prints:
a = 1000000000
b = -727379968
c = 0xe8d4a51000

The hex output is strange...

Thanks 
Martin.

-- 
The early bird catches the worm. If you want something else for       
breakfast, get up later.



More information about the Java mailing list