RFR(XS): 8198906: JDK-8196882 breaks VS2013 Win32 builds

David Holmes david.holmes at oracle.com
Fri Mar 2 01:45:09 UTC 2018


On 2/03/2018 6:29 AM, Kim Barrett wrote:
> Please review this change to fix a build failure on Win32 when using
> VS2013 (and likely earlier).  In os::vsnprintf, cast the int result to
> size_t for comparison with the buffer size, after having verified the
> result is non-negative.

Seems harmless.

> I'm not sure why this failure doesn't occur with VS2013 Win64 builds.

I'm a bit confused how a function that takes a parameter indicating the 
number of characters to write, and then returns the number of characters 
written, can use two different, and potentially different sized, types! 
On 64-bit size_t would be 64-bit but int is 32-bit, so how can you 
possibly always return the correct count? Granted it may not be a 
practical concern, but from a typing perspective this seems seriously 
messed up. Further size_t is unsigned so has twice the range of int - so 
even on 32-bit this doesn't make sense.

Am I missing something?

Thanks,
David

> CR:
> https://bugs.openjdk.java.net/browse/JDK-8198906
> 
> Webrev:
> http://cr.openjdk.java.net/~kbarrett/8198906/open.00/
> 
> Testing:
> VS2013 Win64 still builds.  I don't have access to Win32, but the
> change is pretty simple.
> 
> 


More information about the hotspot-dev mailing list