RFR: 8318127: align_up has potential overflow [v6]

Kim Barrett kbarrett at openjdk.org
Wed Oct 9 15:59:25 UTC 2024


On Wed, 9 Oct 2024 14:19:38 GMT, Casper Norrbin <cnorrbin at openjdk.org> wrote:

>> Hi everyone,
>> 
>> The `align_up` function contained code which could potentially overflow and produce an incorrect result. This PR adds an assert to check for such.
>> 
>> Additionally, two test case that previously caused an overflow have been updated to use the highest possible values that do not trigger an overflow.
>
> Casper Norrbin has updated the pull request incrementally with one additional commit since the last revision:
> 
>   ifdef

Changes requested by kbarrett (Reviewer).

test/hotspot/gtest/utilities/test_align.cpp line 208:

> 206: }
> 207: 
> 208: #ifdef ASSERT

I forgot about the need for this. Glad you caught it.

But include test_fail_alignment under the conditional, to avoid possibility of "defined but unused" warnings.

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

PR Review: https://git.openjdk.org/jdk/pull/20808#pullrequestreview-2357556792
PR Review Comment: https://git.openjdk.org/jdk/pull/20808#discussion_r1793768593


More information about the hotspot-dev mailing list