Fix PR gdb/265, 64-bit pointers in Java
Per Bothner
per@bothner.com
Wed Feb 20 15:04:00 GMT 2002
Daniel Jacobowitz wrote:
> On Mon, Feb 11, 2002 at 12:38:18AM -0500, Daniel Jacobowitz wrote:
>
>>I don't know if Java allows the implicit 0x123456789 -> 0x123456789L
>>conversion that we all know and love in C,
It doesn't. From the Java Languages Specification 2nd ed 3.10.1:
A compile-time error occurs if a decimal literal of type int is larger
than 2147483648 (2^31), or if the literal 2147483648 appears anywhere
other than as the operand of the unary - operator, or if a hexadecimal
or octal int literal does not fit in 32 bits.
> but it certainly behooves us to act that way on the command line.
I don't see that. I think the current error is reasonable, but perhaps
changing it to a warning would be better. However, silently changing
the type may change which overloaded methods gets chosen, so it's a bad
idea.
> Per never answered me,
Sorry. I guess I didn't notice the question to me.
> I'm committing this as reasonably obvious,
Please don't - it's wrong.
>>+ if (type == java_int_type && n > (ULONGEST)0xffffffff)
>>+ type = java_long_type;
One might argue that if the radix is 10, perhaps it should be
n > (ULONGEST)0x80000000 (given that Java doesn't have unsigned types).
--
--Per Bothner
per@bothner.com http://www.bothner.com/per/
More information about the Gdb-patches
mailing list