Skip to content
This repository was archived by the owner on Feb 2, 2023. It is now read-only.

Commit c87d399

Browse files
author
Yuri Nesterenko
committed
8232084: HotSpot build failed with GCC 9.2.1
Reviewed-by: bae Backport-of: 11fbd78
1 parent 613eb44 commit c87d399

File tree

6 files changed

+20
-2
lines changed

6 files changed

+20
-2
lines changed

make/lib/Awt2dLibraries.gmk

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -390,7 +390,7 @@ $(eval $(call SetupJdkLibrary, BUILD_LIBLCMS, \
390390
libawt/java2d, \
391391
HEADERS_FROM_SRC := $(LIBLCMS_HEADERS_FROM_SRC), \
392392
DISABLED_WARNINGS_gcc := format-nonliteral type-limits \
393-
misleading-indentation undef unused-function, \
393+
misleading-indentation undef stringop-truncation unused-function, \
394394
DISABLED_WARNINGS_clang := tautological-compare format-nonliteral undef, \
395395
DISABLED_WARNINGS_solstudio := E_STATEMENT_NOT_REACHED, \
396396
DISABLED_WARNINGS_microsoft := 4819, \

make/lib/Lib-jdk.jdwp.agent.gmk

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -31,6 +31,7 @@ $(eval $(call SetupJdkLibrary, BUILD_LIBDT_SOCKET, \
3131
NAME := dt_socket, \
3232
OPTIMIZATION := LOW, \
3333
CFLAGS := $(CFLAGS_JDKLIB) $(LIBDT_SOCKET_CPPFLAGS), \
34+
DISABLED_WARNINGS_gcc := stringop-truncation, \
3435
EXTRA_HEADER_DIRS := \
3536
include \
3637
libjdwp/export, \

src/hotspot/cpu/x86/macroAssembler_x86.hpp

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -114,7 +114,8 @@ class MacroAssembler: public Assembler {
114114
// short offset operators (jmp and jcc)
115115
char* disp = (char*) &branch[1];
116116
int imm8 = target - (address) &disp[1];
117-
guarantee(this->is8bit(imm8), "Short forward jump exceeds 8-bit offset at %s:%d", file, line);
117+
guarantee(this->is8bit(imm8), "Short forward jump exceeds 8-bit offset at %s:%d",
118+
file == NULL ? "<NULL>" : file, line);
118119
*disp = imm8;
119120
} else {
120121
int* disp = (int*) &branch[(op == 0x0F || op == 0xC7)? 2: 1];

src/hotspot/share/services/diagnosticArgument.cpp

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -151,7 +151,13 @@ template <> void DCmdArgument<bool>::parse_value(const char* str,
151151
ResourceMark rm;
152152

153153
char* buf = NEW_RESOURCE_ARRAY(char, len + 1);
154+
155+
PRAGMA_DIAG_PUSH
156+
PRAGMA_STRINGOP_TRUNCATION_IGNORED
157+
// This code can incorrectly cause a "stringop-truncation" warning with gcc
154158
strncpy(buf, str, len);
159+
PRAGMA_DIAG_POP
160+
155161
buf[len] = '\0';
156162
Exceptions::fthrow(THREAD_AND_LOCATION, vmSymbols::java_lang_IllegalArgumentException(),
157163
"Boolean parsing error in command argument '%s'. Could not parse: %s.\n", _name, buf);

src/hotspot/share/utilities/compilerWarnings.hpp

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -62,4 +62,8 @@
6262
#define PRAGMA_FORMAT_IGNORED
6363
#endif
6464

65+
#ifndef PRAGMA_STRINGOP_TRUNCATION_IGNORED
66+
#define PRAGMA_STRINGOP_TRUNCATION_IGNORED
67+
#endif
68+
6569
#endif // SHARE_UTILITIES_COMPILERWARNINGS_HPP

src/hotspot/share/utilities/compilerWarnings_gcc.hpp

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -50,6 +50,12 @@
5050

5151
#define PRAGMA_FORMAT_IGNORED PRAGMA_DISABLE_GCC_WARNING("-Wformat")
5252

53+
// Disable -Wstringop-truncation which is introduced in GCC 8.
54+
// https://gcc.gnu.org/gcc-8/changes.html
55+
#if !defined(__clang_major__) && (__GNUC__ >= 8)
56+
#define PRAGMA_STRINGOP_TRUNCATION_IGNORED PRAGMA_DISABLE_GCC_WARNING("-Wstringop-truncation")
57+
#endif
58+
5359
#if defined(__clang_major__) && \
5460
(__clang_major__ >= 4 || \
5561
(__clang_major__ >= 3 && __clang_minor__ >= 1)) || \

0 commit comments

Comments
 (0)