summaryrefslogtreecommitdiffstats
path: root/recipes-core/openjdk/patches-openjdk-8/0019-hotspot-Turn-on-the-Wreturn-type-warning.patch
diff options
context:
space:
mode:
authorAndré Draszik <andre.draszik@jci.com>2018-08-14 13:50:58 +0100
committerRichard Leitner <richard.leitner@skidata.com>2018-08-14 16:41:47 +0200
commite89564dc67cf0136d998a73813c74d9e174f30af (patch)
treeb6b8b90360be488da280b06833c604858fea8c6a /recipes-core/openjdk/patches-openjdk-8/0019-hotspot-Turn-on-the-Wreturn-type-warning.patch
parentcd17a0f9389594d931d859472c18d166d4996df1 (diff)
downloadmeta-java-e89564dc67cf0136d998a73813c74d9e174f30af.tar.gz
openjdk-8: gcc-8 fix #4: undefined behaviour (hotspot)
Using gcc-8, Hotspot is being miscompiled, resulting in non- working binaries. The reason is undefined behaviour, which gcc-8 even warns about and errors out. We have so far have taped over those warnings, but it turns out that we simply cannot do that. Add patches to address undefined behaviour causing miscompilation of hotsport. This also means we can remove the -Wno-error=return-type C compiler flag again which was recently added in error in commit 52fb41cec7d5 ("openjdk-8: fix build for gcc8.x") only hiding the compiler warnings/errors that were flagging the incorrect code in the first place. With these patches applied, the openjdk-8 ARM port works again: | RESULTS: | RESULTS - ping.PingTest.test_ping - Testcase 964: PASSED (0.04s) | RESULTS - ssh.SSHTest.test_ssh - Testcase 224: PASSED (0.68s) | RESULTS - java.JavaTest.test_java_exists - Testcase -1: PASSED (0.14s) | RESULTS - java.JavaTest.test_java_jar_comp_mode - Testcase -1: FAILED (5.13s) | RESULTS - java.JavaTest.test_java_jar_int_mode - Testcase -1: PASSED (4.48s) | RESULTS - java.JavaTest.test_java_jar_works - Testcase -1: PASSED (4.44s) | RESULTS - java.JavaTest.test_java_version - Testcase -1: PASSED (3.66s) | RESULTS - javac.JavacTest.test_javac_exists - Testcase -1: PASSED (0.13s) | RESULTS - javac.JavacTest.test_javac_works - Testcase -1: PASSED (30.87s) | SUMMARY: | openjdk-8-test-image () - Ran 9 tests in 50.263s The java.JavaTest.test_java_jar_comp_mode failure can be ignored for now, as that test verifies compiled mode which is not available on arm. The testcase must be fixed instead. (We need to refresh one unrelated existing patch to avoid patch fuzz warnings) Signed-off-by: André Draszik <andre.draszik@jci.com> Signed-off-by: Richard Leitner <richard.leitner@skidata.com>
Diffstat (limited to 'recipes-core/openjdk/patches-openjdk-8/0019-hotspot-Turn-on-the-Wreturn-type-warning.patch')
-rw-r--r--recipes-core/openjdk/patches-openjdk-8/0019-hotspot-Turn-on-the-Wreturn-type-warning.patch233
1 files changed, 233 insertions, 0 deletions
diff --git a/recipes-core/openjdk/patches-openjdk-8/0019-hotspot-Turn-on-the-Wreturn-type-warning.patch b/recipes-core/openjdk/patches-openjdk-8/0019-hotspot-Turn-on-the-Wreturn-type-warning.patch
new file mode 100644
index 0000000..0156978
--- /dev/null
+++ b/recipes-core/openjdk/patches-openjdk-8/0019-hotspot-Turn-on-the-Wreturn-type-warning.patch
@@ -0,0 +1,233 @@
1From cc0d371f17c0ab060eb1e6b42d4bf053a2cbc3ba Mon Sep 17 00:00:00 2001
2From: =?UTF-8?q?Andr=C3=A9=20Draszik?= <andre.draszik@jci.com>
3Date: Mon, 13 Aug 2018 16:48:32 +0100
4Subject: [PATCH 5/5] hotspot: Turn on the -Wreturn-type warning
5MIME-Version: 1.0
6Content-Type: text/plain; charset=UTF-8
7Content-Transfer-Encoding: 8bit
8
9|# HG changeset patch
10|# User stefank
11|# Date 1525453613 -3600
12|# Fri May 04 18:06:53 2018 +0100
13|# Node ID 07a1135a327362f157955d470fad5df07cc35164
14|# Parent de79964656fc652f2085dac4fe99bcc128b5a3b1
158062808, PR3548: Turn on the -Wreturn-type warning
16Reviewed-by: mgerdin, tschatzl, coleenp, jrose, kbarrett
17
18Signed-off-by: André Draszik <andre.draszik@jci.com>
19Upstream-Status: Backport
20---
21 hotspot/make/linux/makefiles/gcc.make | 2 +-
22 hotspot/src/cpu/x86/vm/x86_32.ad | 1 +
23 hotspot/src/os_cpu/linux_x86/vm/os_linux_x86.cpp | 1 +
24 hotspot/src/share/vm/classfile/defaultMethods.cpp | 4 ++--
25 hotspot/src/share/vm/classfile/symbolTable.cpp | 4 ++--
26 hotspot/src/share/vm/classfile/systemDictionary.cpp | 6 +++---
27 hotspot/src/share/vm/memory/heapInspection.hpp | 2 +-
28 hotspot/src/share/vm/memory/metaspaceShared.hpp | 2 +-
29 hotspot/src/share/vm/oops/constantPool.hpp | 2 +-
30 hotspot/src/share/vm/prims/jvm.cpp | 2 +-
31 hotspot/src/share/vm/runtime/reflection.cpp | 2 +-
32 hotspot/src/share/vm/runtime/sharedRuntime.cpp | 2 +-
33 hotspot/src/share/vm/services/memTracker.hpp | 2 +-
34 13 files changed, 17 insertions(+), 15 deletions(-)
35
36diff --git a/hotspot/make/linux/makefiles/gcc.make b/hotspot/make/linux/makefiles/gcc.make
37index 272afcea..157afff2 100644
38--- a/hotspot/make/linux/makefiles/gcc.make
39+++ b/hotspot/make/linux/makefiles/gcc.make
40@@ -207,7 +207,7 @@ ifeq ($(USE_CLANG), true)
41 WARNINGS_ARE_ERRORS += -Wno-return-type -Wno-empty-body
42 endif
43
44-WARNING_FLAGS = -Wpointer-arith -Wsign-compare -Wundef -Wunused-function -Wunused-value
45+WARNING_FLAGS = -Wpointer-arith -Wsign-compare -Wundef -Wunused-function -Wunused-value -Wreturn-type
46
47 ifeq ($(USE_CLANG),)
48 # Since GCC 4.3, -Wconversion has changed its meanings to warn these implicit
49diff --git a/hotspot/src/cpu/x86/vm/x86_32.ad b/hotspot/src/cpu/x86/vm/x86_32.ad
50index f42d1a28..c8f4ee16 100644
51--- a/hotspot/src/cpu/x86/vm/x86_32.ad
52+++ b/hotspot/src/cpu/x86/vm/x86_32.ad
53@@ -1250,6 +1250,7 @@ uint MachSpillCopyNode::implementation( CodeBuffer *cbuf, PhaseRegAlloc *ra_, bo
54
55
56 Unimplemented();
57+ return 0; // Mute compiler
58 }
59
60 #ifndef PRODUCT
61diff --git a/hotspot/src/os_cpu/linux_x86/vm/os_linux_x86.cpp b/hotspot/src/os_cpu/linux_x86/vm/os_linux_x86.cpp
62index fb96738a..4cdeb372 100644
63--- a/hotspot/src/os_cpu/linux_x86/vm/os_linux_x86.cpp
64+++ b/hotspot/src/os_cpu/linux_x86/vm/os_linux_x86.cpp
65@@ -541,6 +541,7 @@ JVM_handle_linux_signal(int sig,
66 err.report_and_die();
67
68 ShouldNotReachHere();
69+ return true; // Mute compiler
70 }
71
72 void os::Linux::init_thread_fpu_state(void) {
73diff --git a/hotspot/src/share/vm/classfile/defaultMethods.cpp b/hotspot/src/share/vm/classfile/defaultMethods.cpp
74index 0e3d5d7b..d3df1d15 100644
75--- a/hotspot/src/share/vm/classfile/defaultMethods.cpp
76+++ b/hotspot/src/share/vm/classfile/defaultMethods.cpp
77@@ -506,7 +506,7 @@ Symbol* MethodFamily::generate_method_message(Symbol *klass_name, Method* method
78 ss.write((const char*)name->bytes(), name->utf8_length());
79 ss.write((const char*)signature->bytes(), signature->utf8_length());
80 ss.print(" is abstract");
81- return SymbolTable::new_symbol(ss.base(), (int)ss.size(), CHECK_NULL);
82+ return SymbolTable::new_symbol(ss.base(), (int)ss.size(), THREAD);
83 }
84
85 Symbol* MethodFamily::generate_conflicts_message(GrowableArray<Method*>* methods, TRAPS) const {
86@@ -521,7 +521,7 @@ Symbol* MethodFamily::generate_conflicts_message(GrowableArray<Method*>* methods
87 ss.print(".");
88 ss.write((const char*)name->bytes(), name->utf8_length());
89 }
90- return SymbolTable::new_symbol(ss.base(), (int)ss.size(), CHECK_NULL);
91+ return SymbolTable::new_symbol(ss.base(), (int)ss.size(), THREAD);
92 }
93
94
95diff --git a/hotspot/src/share/vm/classfile/symbolTable.cpp b/hotspot/src/share/vm/classfile/symbolTable.cpp
96index ec97077b..2621a7d6 100644
97--- a/hotspot/src/share/vm/classfile/symbolTable.cpp
98+++ b/hotspot/src/share/vm/classfile/symbolTable.cpp
99@@ -249,7 +249,7 @@ Symbol* SymbolTable::lookup(const char* name, int len, TRAPS) {
100 MutexLocker ml(SymbolTable_lock, THREAD);
101
102 // Otherwise, add to symbol to table
103- return the_table()->basic_add(index, (u1*)name, len, hashValue, true, CHECK_NULL);
104+ return the_table()->basic_add(index, (u1*)name, len, hashValue, true, THREAD);
105 }
106
107 Symbol* SymbolTable::lookup(const Symbol* sym, int begin, int end, TRAPS) {
108@@ -288,7 +288,7 @@ Symbol* SymbolTable::lookup(const Symbol* sym, int begin, int end, TRAPS) {
109 // Grab SymbolTable_lock first.
110 MutexLocker ml(SymbolTable_lock, THREAD);
111
112- return the_table()->basic_add(index, (u1*)buffer, len, hashValue, true, CHECK_NULL);
113+ return the_table()->basic_add(index, (u1*)buffer, len, hashValue, true, THREAD);
114 }
115
116 Symbol* SymbolTable::lookup_only(const char* name, int len,
117diff --git a/hotspot/src/share/vm/classfile/systemDictionary.cpp b/hotspot/src/share/vm/classfile/systemDictionary.cpp
118index 8d2e7f49..62bdba3e 100644
119--- a/hotspot/src/share/vm/classfile/systemDictionary.cpp
120+++ b/hotspot/src/share/vm/classfile/systemDictionary.cpp
121@@ -229,15 +229,15 @@ Klass* SystemDictionary::resolve_or_null(Symbol* class_name, Handle class_loader
122 class_name->as_C_string(),
123 class_loader.is_null() ? "null" : class_loader->klass()->name()->as_C_string()));
124 if (FieldType::is_array(class_name)) {
125- return resolve_array_class_or_null(class_name, class_loader, protection_domain, CHECK_NULL);
126+ return resolve_array_class_or_null(class_name, class_loader, protection_domain, THREAD);
127 } else if (FieldType::is_obj(class_name)) {
128 ResourceMark rm(THREAD);
129 // Ignore wrapping L and ;.
130 TempNewSymbol name = SymbolTable::new_symbol(class_name->as_C_string() + 1,
131 class_name->utf8_length() - 2, CHECK_NULL);
132- return resolve_instance_class_or_null(name, class_loader, protection_domain, CHECK_NULL);
133+ return resolve_instance_class_or_null(name, class_loader, protection_domain, THREAD);
134 } else {
135- return resolve_instance_class_or_null(class_name, class_loader, protection_domain, CHECK_NULL);
136+ return resolve_instance_class_or_null(class_name, class_loader, protection_domain, THREAD);
137 }
138 }
139
140diff --git a/hotspot/src/share/vm/memory/heapInspection.hpp b/hotspot/src/share/vm/memory/heapInspection.hpp
141index 09ee6602..c5fec15c 100644
142--- a/hotspot/src/share/vm/memory/heapInspection.hpp
143+++ b/hotspot/src/share/vm/memory/heapInspection.hpp
144@@ -367,7 +367,7 @@ class HeapInspection : public StackObj {
145 _csv_format(csv_format), _print_help(print_help),
146 _print_class_stats(print_class_stats), _columns(columns) {}
147 void heap_inspection(outputStream* st) NOT_SERVICES_RETURN;
148- size_t populate_table(KlassInfoTable* cit, BoolObjectClosure* filter = NULL) NOT_SERVICES_RETURN;
149+ size_t populate_table(KlassInfoTable* cit, BoolObjectClosure* filter = NULL) NOT_SERVICES_RETURN_(0);
150 static void find_instances_at_safepoint(Klass* k, GrowableArray<oop>* result) NOT_SERVICES_RETURN;
151 private:
152 void iterate_over_heap(KlassInfoTable* cit, BoolObjectClosure* filter = NULL);
153diff --git a/hotspot/src/share/vm/memory/metaspaceShared.hpp b/hotspot/src/share/vm/memory/metaspaceShared.hpp
154index 2f3abae6..d58ebecb 100644
155--- a/hotspot/src/share/vm/memory/metaspaceShared.hpp
156+++ b/hotspot/src/share/vm/memory/metaspaceShared.hpp
157@@ -93,7 +93,7 @@ class MetaspaceShared : AllStatic {
158 static void preload_and_dump(TRAPS) NOT_CDS_RETURN;
159 static int preload_and_dump(const char * class_list_path,
160 GrowableArray<Klass*>* class_promote_order,
161- TRAPS) NOT_CDS_RETURN;
162+ TRAPS) NOT_CDS_RETURN_(0);
163
164 static ReservedSpace* shared_rs() {
165 CDS_ONLY(return _shared_rs);
166diff --git a/hotspot/src/share/vm/oops/constantPool.hpp b/hotspot/src/share/vm/oops/constantPool.hpp
167index f170decc..a1e168b2 100644
168--- a/hotspot/src/share/vm/oops/constantPool.hpp
169+++ b/hotspot/src/share/vm/oops/constantPool.hpp
170@@ -349,7 +349,7 @@ class ConstantPool : public Metadata {
171
172 Klass* klass_at(int which, TRAPS) {
173 constantPoolHandle h_this(THREAD, this);
174- return klass_at_impl(h_this, which, CHECK_NULL);
175+ return klass_at_impl(h_this, which, THREAD);
176 }
177
178 Symbol* klass_name_at(int which); // Returns the name, w/o resolving.
179diff --git a/hotspot/src/share/vm/prims/jvm.cpp b/hotspot/src/share/vm/prims/jvm.cpp
180index 067fd3ac..b9e5b322 100644
181--- a/hotspot/src/share/vm/prims/jvm.cpp
182+++ b/hotspot/src/share/vm/prims/jvm.cpp
183@@ -4280,7 +4280,7 @@ JVM_ENTRY(jlong,JVM_DTraceActivate(
184 JVM_DTraceProvider* providers))
185 JVMWrapper("JVM_DTraceActivate");
186 return DTraceJSDT::activate(
187- version, module_name, providers_count, providers, CHECK_0);
188+ version, module_name, providers_count, providers, THREAD);
189 JVM_END
190
191 JVM_ENTRY(jboolean,JVM_DTraceIsProbeEnabled(JNIEnv* env, jmethodID method))
192diff --git a/hotspot/src/share/vm/runtime/reflection.cpp b/hotspot/src/share/vm/runtime/reflection.cpp
193index e2f282ee..679e1775 100644
194--- a/hotspot/src/share/vm/runtime/reflection.cpp
195+++ b/hotspot/src/share/vm/runtime/reflection.cpp
196@@ -1093,7 +1093,7 @@ oop Reflection::invoke(instanceKlassHandle klass, methodHandle reflected_method,
197 } else {
198 if (rtype == T_BOOLEAN || rtype == T_BYTE || rtype == T_CHAR || rtype == T_SHORT)
199 narrow((jvalue*) result.get_value_addr(), rtype, CHECK_NULL);
200- return box((jvalue*) result.get_value_addr(), rtype, CHECK_NULL);
201+ return box((jvalue*) result.get_value_addr(), rtype, THREAD);
202 }
203 }
204
205diff --git a/hotspot/src/share/vm/runtime/sharedRuntime.cpp b/hotspot/src/share/vm/runtime/sharedRuntime.cpp
206index 8ffa8ab3..219bcd5c 100644
207--- a/hotspot/src/share/vm/runtime/sharedRuntime.cpp
208+++ b/hotspot/src/share/vm/runtime/sharedRuntime.cpp
209@@ -1038,7 +1038,7 @@ Handle SharedRuntime::find_callee_info(JavaThread* thread, Bytecodes::Code& bc,
210 // last java frame on stack (which includes native call frames)
211 vframeStream vfst(thread, true); // Do not skip and javaCalls
212
213- return find_callee_info_helper(thread, vfst, bc, callinfo, CHECK_(Handle()));
214+ return find_callee_info_helper(thread, vfst, bc, callinfo, THREAD);
215 }
216
217
218diff --git a/hotspot/src/share/vm/services/memTracker.hpp b/hotspot/src/share/vm/services/memTracker.hpp
219index 38a027ea..13436a4b 100644
220--- a/hotspot/src/share/vm/services/memTracker.hpp
221+++ b/hotspot/src/share/vm/services/memTracker.hpp
222@@ -64,7 +64,7 @@ class MemTracker : AllStatic {
223 const NativeCallStack& stack, MEMFLAGS flag = mtNone) { }
224 static inline void record_virtual_memory_commit(void* addr, size_t size, const NativeCallStack& stack) { }
225 static inline Tracker get_virtual_memory_uncommit_tracker() { return Tracker(); }
226- static inline Tracker get_virtual_memory_release_tracker() { }
227+ static inline Tracker get_virtual_memory_release_tracker() { return Tracker(); }
228 static inline void record_virtual_memory_type(void* addr, MEMFLAGS flag) { }
229 static inline void record_thread_stack(void* addr, size_t size) { }
230 static inline void release_thread_stack(void* addr, size_t size) { }
231--
2322.18.0
233