void-packages/srcpkgs/openjdk16-bootstrap/patches/FixNullPtrCast.patch

74 lines
3.3 KiB
Diff

Subject: Fix cast errors with latest GCC (11.2)
Upstream: No
Author: Simon Frankenberger <simon-alpine@fraho.eu>
This patch fixes multiple casting errors reported by GCC 11.2
--- old/src/hotspot/share/oops/access.hpp
+++ new/src/hotspot/share/oops/access.hpp
@@ -294,8 +294,8 @@
static inline void arraycopy(arrayOop src_obj, size_t src_offset_in_bytes,
arrayOop dst_obj, size_t dst_offset_in_bytes,
size_t length) {
- AccessT::arraycopy(src_obj, src_offset_in_bytes, reinterpret_cast<const T*>(NULL),
- dst_obj, dst_offset_in_bytes, reinterpret_cast<T*>(NULL),
+ AccessT::arraycopy(src_obj, src_offset_in_bytes, static_cast<const T*>(NULL),
+ dst_obj, dst_offset_in_bytes, static_cast<T*>(NULL),
length);
}
@@ -303,7 +303,7 @@
static inline void arraycopy_to_native(arrayOop src_obj, size_t src_offset_in_bytes,
T* dst,
size_t length) {
- AccessT::arraycopy(src_obj, src_offset_in_bytes, reinterpret_cast<const T*>(NULL),
+ AccessT::arraycopy(src_obj, src_offset_in_bytes, static_cast<const T*>(NULL),
NULL, 0, dst,
length);
}
@@ -313,15 +313,15 @@
arrayOop dst_obj, size_t dst_offset_in_bytes,
size_t length) {
AccessT::arraycopy(NULL, 0, src,
- dst_obj, dst_offset_in_bytes, reinterpret_cast<T*>(NULL),
+ dst_obj, dst_offset_in_bytes, static_cast<T*>(NULL),
length);
}
static inline bool oop_arraycopy(arrayOop src_obj, size_t src_offset_in_bytes,
arrayOop dst_obj, size_t dst_offset_in_bytes,
size_t length) {
- return AccessT::oop_arraycopy(src_obj, src_offset_in_bytes, reinterpret_cast<const HeapWord*>(NULL),
- dst_obj, dst_offset_in_bytes, reinterpret_cast<HeapWord*>(NULL),
+ return AccessT::oop_arraycopy(src_obj, src_offset_in_bytes, static_cast<const HeapWord*>(NULL),
+ dst_obj, dst_offset_in_bytes, static_cast<HeapWord*>(NULL),
length);
}
--- old/src/hotspot/cpu/x86/interp_masm_x86.cpp
+++ new/src/hotspot/cpu/x86/interp_masm_x86.cpp
@@ -1122,7 +1122,7 @@
bind(loop);
// check if current entry is used
- cmpptr(Address(rmon, BasicObjectLock::obj_offset_in_bytes()), (int32_t) NULL);
+ cmpptr(Address(rmon, BasicObjectLock::obj_offset_in_bytes()), 0);
jcc(Assembler::notEqual, exception);
addptr(rmon, entry_size); // otherwise advance to next entry
--- old/src/hotspot/cpu/x86/interpreterRT_x86_64.cpp
+++ new/src/hotspot/cpu/x86/interpreterRT_x86_64.cpp
@@ -443,10 +443,10 @@
_from -= Interpreter::stackElementSize;
if (_num_int_args < Argument::n_int_register_parameters_c-1) {
- *_int_args++ = (*from_addr == 0) ? NULL : (intptr_t)from_addr;
+ *_int_args++ = (*from_addr == 0) ? (intptr_t) 0 : (intptr_t) from_addr;
_num_int_args++;
} else {
- *_to++ = (*from_addr == 0) ? NULL : (intptr_t) from_addr;
+ *_to++ = (*from_addr == 0) ? (intptr_t) 0 : (intptr_t) from_addr;
}
}