RFR: 8280476: [macOS] : hotspot arm64 bug exposed by latest clang [v2]

Andrew Haley aph at openjdk.java.net
Fri Feb 4 10:05:07 UTC 2022


On Thu, 3 Feb 2022 17:21:53 GMT, Daniel D. Daugherty <dcubed at openjdk.org> wrote:

>> It's definitely UB according to the language.  Then there's the question of what the hardware might actually implement in the cases where the compiler doesn't recognize it and the relevant instruction(s) are executed with that value.  I know I've seen hardware that used the shift quantity mod word-size.  I think I've seen hardware that would just shift out all the bits, leaving a value of 0.  One reason for the language to make this UB is because of hardware variance.  Oh, and I *think* I've seen hardware where it was UB and would produce "strange" results.
>
> @kimbarrett - Thanks for confirming that we have UB here.
> 
> @adinn - I'll take a look and updating the `assert()` calls and retest.

> First thing to note is that `replicate` is never actually called with `count == 0`.

This is crucial: it means we have no UB.

Could I ask you to take the opportunity add a little of this commentary to the rather opaque code? Pretty please? :-)

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

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


More information about the hotspot-compiler-dev mailing list