RFR (trivial): 8235819: -Wformat-overflow is reported from GCC 9

Yasumasa Suenaga suenaga at oss.nttdata.com
Thu Dec 12 12:51:12 UTC 2019

Hi all,

Please review this trivial change:

   JBS: https://bugs.openjdk.java.net/browse/JDK-8235819
   webrev: http://cr.openjdk.java.net/~ysuenaga/JDK-8235819/webrev.00/

I saw format-overflow warnings in g1GCPhaseTimes.cpp when I built jdk/jdk with GCC 9 on Fedora 31 as below:

/home/ysuenaga/OpenJDK/jdk/src/hotspot/share/gc/g1/g1GCPhaseTimes.cpp:319:17: error: '%s' directive argument is null [-Werror=format-overflow=]
   319 | out->print("%s", Indents[indent + 1]);
       | ~~~~~~~~~~^~~~~~~~~~~~~~~~~~~~~~~~~~~

Indents[] seems to be insufficient.
We need to give enough entries to it.

This patch passed all tests on submit repo (mach5-one-ysuenaga-JDK-8235819-20191212-0925-7464553).



More information about the hotspot-gc-dev mailing list