On Thu, 20 Jun 2024 08:29:39 GMT, Julian Waters <jwat...@openjdk.org> wrote:
> In [JDK-8302671](https://bugs.openjdk.org/browse/JDK-8302671) I fixed a > memmove decay bug by rewriting a sizeof on an array to an explicit size of > 256, but this is a bit of a band aid fix. It's come to my attention that in > C++, one can pass an array by reference, which causes sizeof to work > correctly on an array and has the added bonus of enforcing an array of that > size on the arguments passed to that method. I've reverted my change from > 8302671 and instead explicitly made kstate an array reference so that sizeof > works on the array as expected, and that the array size can be explicitly set > in the array brackets > > Verification: https://godbolt.org/z/Ezj76eWWY and GitHub Actions Harmless, I hope, but it doesn't change that 256 is hard-coded in multiple places AND that the caller has to get it right too .. if the caller passes a shorter array things can still go wrong. Why can't we EVERYWHERE use the definition used to create the array passed in KB_STATE_SIZE = 256 instead of a mixture. ------------- PR Review: https://git.openjdk.org/jdk/pull/19798#pullrequestreview-2131336310