8039743: Use correct format specifier to print size_t values and pointers in the GC code

Jon Masamitsu jon.masamitsu at oracle.com
Wed Apr 9 22:42:42 UTC 2014


http://cr.openjdk.java.net/~stefank/8039743/webrev.00/src/share/vm/memory/defNewGeneration.cpp.udiff.html

-    gclog_or_tty->print(" (promotion failure size = " SIZE_FORMAT ") ",
+    gclog_or_tty->print(" (promotion failure size = %u) ",
                          old->size());


size() returning an int, did you want %d instead of %u?

Rest looks good.

Jon

On 04/09/2014 06:36 AM, Stefan Karlsson wrote:
> Hi all,
>
> There are a number of occurrence in HotSpot that use %d and 0x%x to 
> print size_t values and pointers. This is incorrect on platforms that 
> have different type sizes for size_t and pointers compared to ints.
>
> This patch only touches the GC code, but is based on an larger patch 
> from Mikael Vidstedt.
>
> http://cr.openjdk.java.net/~stefank/8039743/webrev.00/
> https://bugs.openjdk.java.net/browse/JDK-8039743
>
> thanks,
> StefanK




More information about the hotspot-gc-dev mailing list