# HG changeset patch # User ysuenaga # Date 1571360240 -32400 # Node ID 9f5b92d5a1b2f96636a36d5755e7356349105331 # Parent 5f14a659a8cbb7b83af4b10fd86ca254d44bed44 8232084: HotSpot build failed with GCC 9.2.1 Reviewed-by: sspitsyn, cjplummer, dholmes, iklam diff -r 5f14a659a8cb -r 9f5b92d5a1b2 src/hotspot/cpu/x86/macroAssembler_x86.hpp --- a/src/hotspot/cpu/x86/macroAssembler_x86.hpp Thu Oct 17 22:41:36 2019 +0200 +++ b/src/hotspot/cpu/x86/macroAssembler_x86.hpp Fri Oct 18 09:57:20 2019 +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]; diff -r 5f14a659a8cb -r 9f5b92d5a1b2 src/hotspot/share/services/diagnosticArgument.cpp --- a/src/hotspot/share/services/diagnosticArgument.cpp Thu Oct 17 22:41:36 2019 +0200 +++ b/src/hotspot/share/services/diagnosticArgument.cpp Fri Oct 18 09:57:20 2019 +0900 @@ -151,7 +151,13 @@ ResourceMark rm; char* buf = NEW_RESOURCE_ARRAY(char, len + 1); + +PRAGMA_DIAG_PUSH +PRAGMA_STRINGOP_TRUNCATION_IGNORED + // This code can incorrectly cause a "stringop-truncation" warning with gcc 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); diff -r 5f14a659a8cb -r 9f5b92d5a1b2 src/hotspot/share/utilities/compilerWarnings.hpp --- a/src/hotspot/share/utilities/compilerWarnings.hpp Thu Oct 17 22:41:36 2019 +0200 +++ b/src/hotspot/share/utilities/compilerWarnings.hpp Fri Oct 18 09:57:20 2019 +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 diff -r 5f14a659a8cb -r 9f5b92d5a1b2 src/hotspot/share/utilities/compilerWarnings_gcc.hpp --- a/src/hotspot/share/utilities/compilerWarnings_gcc.hpp Thu Oct 17 22:41:36 2019 +0200 +++ b/src/hotspot/share/utilities/compilerWarnings_gcc.hpp Fri Oct 18 09:57:20 2019 +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)) || \