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

Kim Barrett kim.barrett at oracle.com
Fri Mar 2 02:28:08 UTC 2018


> On Mar 1, 2018, at 8:45 PM, David Holmes <david.holmes at oracle.com> wrote:
> 
> 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.

Thanks.

>> 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?

As far as I can tell, the relevant standards bodies and such made something of a hash of things here.

> 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