JDK-7115107 : Wrong format specifiers PREDICTIONS_VERBOSE debug output
  • Type: Bug
  • Component: hotspot
  • Sub-Component: gc
  • Affected Version: 7
  • Priority: P4
  • Status: Closed
  • Resolution: Duplicate
  • OS: linux_ubuntu
  • CPU: x86
  • Submitted: 2011-11-23
  • Updated: 2012-03-20
  • Resolved: 2011-11-23
Related Reports
Duplicate :  
Description
FULL PRODUCT VERSION :
Self-built version, hsx22-b06. The bug is in hsx23 too according to the mercurial web viewer.

FULL OS VERSION :
Linux gremio 2.6.38-12-generic #51-Ubuntu SMP Wed Sep 28 14:27:32 UTC 2011 x86_64 x86_64 x86_64 GNU/Linux


A DESCRIPTION OF THE PROBLEM :
The format specifiers for the size_t sized parameters to the gclog_or_tty->print() function call when PREDICTIONS_VERBOSE is set to 1 are wrong. They are %d while they should be %zd according to C99 standard.
(g1CollectorPolicy.cpp:1674 ff)

THE PROBLEM WAS REPRODUCIBLE WITH -Xint FLAG: Did not try

THE PROBLEM WAS REPRODUCIBLE WITH -server FLAG: Yes

STEPS TO FOLLOW TO REPRODUCE THE PROBLEM :
Compile current sources with PREDICTIONS_VERBOSE set to 1.

Run a reasonably large benchmark with -XX:+UseG1GC.

EXPECTED VERSUS ACTUAL BEHAVIOR :
The size_t values should be printed without wraparound at 32 bits on 64 bit machines.
REPRODUCIBILITY :
This bug can be reproduced always.

CUSTOMER SUBMITTED WORKAROUND :
  Bugfix:

E.g. from http://hg.openjdk.java.net/hsx/hsx23-gate/hotspot/file/fde2a39ed7f3/src/share/vm/gc_implementation/g1/g1CollectorPolicy.cpp:

     1677                     "REGIONS %d %d %d "
     1678                     "PENDING_CARDS %d %d "
     1679                     "CARDS_SCANNED %d %d "
     1680                     "RS_LENGTHS %d %d "

But should be

     1677                     "REGIONS %zd %zd %zd "
     1678                     "PENDING_CARDS %zd %zd "
     1679                     "CARDS_SCANNED %zd %zd "
     1680                     "RS_LENGTHS %zd %zd "