--- old/src/hotspot/cpu/x86/macroAssembler_x86.hpp 2019-10-12 12:11:33.680743457 +0900 +++ new/src/hotspot/cpu/x86/macroAssembler_x86.hpp 2019-10-12 12:11:33.541742825 +0900 @@ -114,7 +114,8 @@ // short offset operators (jmp and jcc) char* disp = (char*) &branch[1]; int imm8 = target - (address) &disp[1]; - guarantee(this->is8bit(imm8), "Short forward jump exceeds 8-bit offset at %s:%d", file, line); + guarantee(this->is8bit(imm8), "Short forward jump exceeds 8-bit offset at %s:%d", + file == NULL ? "" : file, line); *disp = imm8; } else { int* disp = (int*) &branch[(op == 0x0F || op == 0xC7)? 2: 1]; --- old/src/hotspot/share/services/diagnosticArgument.cpp 2019-10-12 12:11:34.212745874 +0900 +++ new/src/hotspot/share/services/diagnosticArgument.cpp 2019-10-12 12:11:34.029745042 +0900 @@ -151,7 +151,14 @@ ResourceMark rm; char* buf = NEW_RESOURCE_ARRAY(char, len + 1); + + // This code would be warned as "stringop-truncation" by GCC 8 or later. + // So we avoid it via PRAGMA_STRINGOP_TRUNCATION_IGNORED macro. +PRAGMA_DIAG_PUSH +PRAGMA_STRINGOP_TRUNCATION_IGNORED strncpy(buf, str, len); +PRAGMA_DIAG_POP + buf[len] = '\0'; Exceptions::fthrow(THREAD_AND_LOCATION, vmSymbols::java_lang_IllegalArgumentException(), "Boolean parsing error in command argument '%s'. Could not parse: %s.\n", _name, buf); --- old/src/hotspot/share/utilities/compilerWarnings.hpp 2019-10-12 12:11:34.795748523 +0900 +++ new/src/hotspot/share/utilities/compilerWarnings.hpp 2019-10-12 12:11:34.615747705 +0900 @@ -62,4 +62,8 @@ #define PRAGMA_FORMAT_IGNORED #endif +#ifndef PRAGMA_STRINGOP_TRUNCATION_IGNORED +#define PRAGMA_STRINGOP_TRUNCATION_IGNORED +#endif + #endif // SHARE_UTILITIES_COMPILERWARNINGS_HPP --- old/src/hotspot/share/utilities/compilerWarnings_gcc.hpp 2019-10-12 12:11:35.339750994 +0900 +++ new/src/hotspot/share/utilities/compilerWarnings_gcc.hpp 2019-10-12 12:11:35.158750172 +0900 @@ -50,6 +50,12 @@ #define PRAGMA_FORMAT_IGNORED PRAGMA_DISABLE_GCC_WARNING("-Wformat") +// Disable -Wstringop-truncation which is introduced in GCC 8. +// https://gcc.gnu.org/gcc-8/changes.html +#if !defined(__clang_major__) && (__GNUC__ >= 8) +#define PRAGMA_STRINGOP_TRUNCATION_IGNORED PRAGMA_DISABLE_GCC_WARNING("-Wstringop-truncation") +#endif + #if defined(__clang_major__) && \ (__clang_major__ >= 4 || \ (__clang_major__ >= 3 && __clang_minor__ >= 1)) || \