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

Leo Korinth leo.korinth at oracle.com
Thu Dec 12 14:26:26 UTC 2019


Hi,

Your fix looks good to me (I am not a reviewer). Thanks for fixing this!

In the long run, I believe a better solution would be two have a 
separate function for doing the indentation so that one could use format 
strings to make the indentation level work for any level or, at least, 
assert on over-run. This is a good fix for now however.

Thanks,
Leo


On 12/12/2019 13:51, Yasumasa Suenaga wrote:
> 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).
> 
> 
> Thanks,
> 
> Yasumasa



More information about the hotspot-gc-dev mailing list