RFR: 8352141: UBSAN: fix the left shift of negative value in relocInfo.cpp, internal_word_Relocation::pack_data_to()

Afshin Zafari azafari at openjdk.org
Tue Mar 25 10:13:16 UTC 2025


On Mon, 24 Mar 2025 18:19:29 GMT, Vladimir Kozlov <kvn at openjdk.org> wrote:

> Why it is UB for signed left shift for negative value?

For example in

    signed short int x = -32768;
    signed short int y = x << 1;

the value of `y` would be `0`.

-------------

PR Comment: https://git.openjdk.org/jdk/pull/24196#issuecomment-2750746885


More information about the hotspot-compiler-dev mailing list