RFR: 8145096: Undefined behaviour in HotSpot
Andrew Haley
aph at redhat.com
Fri Dec 18 11:13:45 UTC 2015
On 18/12/15 04:38, John Rose wrote:
> On Dec 17, 2015, at 2:31 AM, Andrew Haley <aph at redhat.com> wrote:
>>
>> I'm sure that it makes no sense ever to construct bitmasks using a
>> signed type. I am doing my best to be certain that I don't break
>> anything. I'll have a look to see if there is some way that I can
>> change this to unsigned without changing behaviour.
>
> This is more reason to avoid using the built-in C operators for bit-twiddling
> and use macros or inlines instead. See globalDefinitions.hpp, near right_n_bits.
> (Which is wrong, but less wrong than writing built-in C operators.)
Mmmm, and I notice that right_n_bits() has undefined behaviour too.
Looks like this task is turning onto something substantial. Never
mind, it can be done in pieces.
Andrew.
More information about the hotspot-dev
mailing list