RFR: 8299213: Bad cast in GrowableArrayWithAllocator<>::grow

Johan Sjölen jsjolen at openjdk.org
Mon Jan 16 09:54:11 UTC 2023


On Mon, 16 Jan 2023 09:11:19 GMT, Afshin Zafari <duke at openjdk.org> wrote:

> ### Description 
> The grow size was wrongfully casted from `int` to `uint32`.
> 
> ### Patch
> The casting is removed.
> 
> ### Tests
> Local: **gtest:GrowableArrays***
> mach5 tier1-5

// precondition: if signed, value >= 0.
// precondition: value < maximum power of two representable by T.
template <typename T, ENABLE_IF(std::is_integral<T>::value)>
inline T next_power_of_2(T value)  {


So this should require an assert that `j >= 0`.

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

PR: https://git.openjdk.org/jdk/pull/12007


More information about the hotspot-dev mailing list