RFR: 8256436: AArch64: Fix undefined behavior for signed right shift in assembler

Andrew Haley aph at openjdk.java.net
Fri Nov 20 09:03:03 UTC 2020


On Fri, 20 Nov 2020 06:39:02 GMT, Xiaohong Gong <xgong at openjdk.org> wrote:

>> Right shift a signed negative value is implementation-defined in C++ (see [1]). It's better to avoid the signed right shift operations,
>> and use the unsigned right shift instead.
>> 
>> [1] https://docs.microsoft.com/en-us/cpp/cpp/left-shift-and-right-shift-operators-input-and-output?view=msvc-160&viewFallbackFrom=vs-2019
>> 
>> Tested jtreg langtools:tier1, hotspot:hotspot_all_no_apps and jdk:jdk_core, and all tests pass without new failures.
>
> Hi, could anyone please take a look at this small PR? Thanks very much!

I'm very skeptical about the need for this. Every AArch64 compiler of which I'm aware treats signed right shift as well defined, and any incoming AArch64 compiler would need to do so in order to be compatible.

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

PR: https://git.openjdk.java.net/jdk/pull/1307


More information about the hotspot-compiler-dev mailing list