RFR(S): 8213419: C2 may hang in MulLNode::Ideal()/MulINode::Ideal() with gcc 8.2.1
aph at redhat.com
Sat Nov 10 09:08:39 UTC 2018
On 11/07/2018 09:06 PM, dean.long at oracle.com wrote:
> OK, I just wanted to make sure the code was doing what you intended.
> Isn't this still undefined behavior:
> jint abs_con = uabs(con);
> if the unsigned value is too big to fit in a signed int?
No, because the conversion of unsigned to signed is not undefined but
For gcc the behavior is:
The result of, or the signal raised by, converting an integer to a
signed integer type when the value cannot be represented in an
object of that type (C90 220.127.116.11, C99 18.104.22.168).
For conversion to a type of width N, the value is reduced modulo
2^N to be within range of the type; no signal is raised.
Nevertheless, I agree with the decision to make everything unsigned.
It's really to only correct way to do arithmetic in C++ on jints. I
wonder if we could redefine a jint type correctly, which is to say it
had the same behaviour as Java. It'd need overloads for all the
Java Platform Lead Engineer
Red Hat UK Ltd. <https://www.redhat.com>
EAC8 43EB D3EF DB98 CC77 2FAD A5CD 6035 332F A671
More information about the hotspot-compiler-dev