Hi Yasumasa,

On 10/10/2019 3:55 pm, Yasumasa Suenaga wrote:
Hi all,

Please review this change:

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


I tried to build OpenJDK on Fedora 30 x64 with GCC 9.2.1, but it was failed in macroAssembler_x86.hpp and diagnosticArgument.cpp .

The macroAssembler fix is fine - we need to ensure there is a NULL check for variables that are passed to %s.

The strncpy fix in diagnosticArgument.cpp I'm less clear about. I don't understand what the warning is warning about. It seems to be concerned about possible truncation, but IIUC truncation is fine, in fact that's exactly why we use strncpy to ensure we don't overflow the buffer if the value we are copying is too long! Is this a case of gcc trying to be too helpful ?? I found this article:

https://developers.redhat.com/blog/2018/05/24/detecting-string-truncation-with-gcc-8/

which suggests that pattern we have of explicitly setting the NUL after the strncpy should be fine. I can't see anything wrong with the existing code. That said the modified code is also not incorrect.

Thanks,
David
-----


(Please see JBS for details)

This change has passed tests on submit repo.


Thanks,

Yasumasa (ysuenaga)

Reply via email to