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

37 lines
1.4 KiB
Diff

Patch taken from Alpine: https://git.alpinelinux.org/aports/tree/community/openjdk17/FixNullPtrCast.patch
same fix for armv7l-musl added
Subject: Fix cast errors with latest GCC
Upstream: No
Author: Simon Frankenberger <simon-alpine@fraho.eu>
This patch fixes one remaining casting error reported by GCC 12 for aarch64
--- old/src/hotspot/cpu/aarch64/interpreterRT_aarch64.cpp
+++ new/src/hotspot/cpu/aarch64/interpreterRT_aarch64.cpp
@@ -267,7 +267,7 @@
virtual void pass_object() {
intptr_t* addr = single_slot_addr();
- intptr_t value = *addr == 0 ? NULL : (intptr_t)addr;
+ intptr_t value = *addr == 0 ? (intptr_t) 0 : (intptr_t)addr;
if (pass_gpr(value) < 0) {
pass_stack<>(value);
}
--- old/src/hotspot/cpu/arm/interpreterRT_arm.cpp
+++ new/src/hotspot/cpu/arm/interpreterRT_arm.cpp
@@ -306,8 +306,8 @@
virtual void pass_object() {
intptr_t from_addr = (intptr_t)(_from + Interpreter::local_offset_in_bytes(0));
if(_last_gp < GPR_PARAMS) {
- _toGP[_last_gp++] = (*(intptr_t*)from_addr == 0) ? NULL : from_addr;
+ _toGP[_last_gp++] = (*(intptr_t*)from_addr == 0) ? (intptr_t) 0 : (intptr_t)from_addr;
} else {
- *_to++ = (*(intptr_t*)from_addr == 0) ? NULL : from_addr;
+ *_to++ = (*(intptr_t*)from_addr == 0) ? (intptr_t) 0 : (intptr_t)from_addr;
}
_from -= Interpreter::stackElementSize;
}