Skip to content

Commit 92571e3

Browse files
committed
8291633: Build failures with GCC 11, Alpine 3 due to incompatible casts from nullptr
Backport-of: c89556f6cd4d0b64f3e9e2f1dc7c51634522f205
1 parent 2c988d1 commit 92571e3

File tree

6 files changed

+16
-16
lines changed

6 files changed

+16
-16
lines changed

src/hotspot/cpu/x86/interp_masm_x86.cpp

+1-1
Original file line numberDiff line numberDiff line change
@@ -1123,7 +1123,7 @@ void InterpreterMacroAssembler::remove_activation(
11231123

11241124
bind(loop);
11251125
// check if current entry is used
1126-
cmpptr(Address(rmon, BasicObjectLock::obj_offset_in_bytes()), (int32_t) NULL);
1126+
cmpptr(Address(rmon, BasicObjectLock::obj_offset_in_bytes()), (int32_t) NULL_WORD);
11271127
jcc(Assembler::notEqual, exception);
11281128

11291129
addptr(rmon, entry_size); // otherwise advance to next entry

src/hotspot/cpu/x86/interpreterRT_x86_64.cpp

+5-5
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
/*
2-
* Copyright (c) 2003, 2019, Oracle and/or its affiliates. All rights reserved.
2+
* Copyright (c) 2003, 2022, Oracle and/or its affiliates. All rights reserved.
33
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
44
*
55
* This code is free software; you can redistribute it and/or modify it
@@ -348,10 +348,10 @@ class SlowSignatureHandler
348348
intptr_t *from_addr = (intptr_t*)(_from + Interpreter::local_offset_in_bytes(0));
349349
_from -= Interpreter::stackElementSize;
350350
if (_num_args < Argument::n_int_register_parameters_c-1) {
351-
*_reg_args++ = (*from_addr == 0) ? NULL : (intptr_t) from_addr;
351+
*_reg_args++ = (*from_addr == 0) ? NULL_WORD : (intptr_t) from_addr;
352352
_num_args++;
353353
} else {
354-
*_to++ = (*from_addr == 0) ? NULL : (intptr_t) from_addr;
354+
*_to++ = (*from_addr == 0) ? NULL_WORD : (intptr_t) from_addr;
355355
}
356356
}
357357

@@ -443,10 +443,10 @@ class SlowSignatureHandler
443443
_from -= Interpreter::stackElementSize;
444444

445445
if (_num_int_args < Argument::n_int_register_parameters_c-1) {
446-
*_int_args++ = (*from_addr == 0) ? NULL : (intptr_t)from_addr;
446+
*_int_args++ = (*from_addr == 0) ? NULL_WORD : (intptr_t)from_addr;
447447
_num_int_args++;
448448
} else {
449-
*_to++ = (*from_addr == 0) ? NULL : (intptr_t) from_addr;
449+
*_to++ = (*from_addr == 0) ? NULL_WORD : (intptr_t) from_addr;
450450
}
451451
}
452452

src/hotspot/cpu/x86/stubGenerator_x86_64.cpp

+1-1
Original file line numberDiff line numberDiff line change
@@ -517,7 +517,7 @@ class StubGenerator: public StubCodeGenerator {
517517
// make sure this code is only executed if there is a pending exception
518518
{
519519
Label L;
520-
__ cmpptr(Address(r15_thread, Thread::pending_exception_offset()), (int32_t) NULL);
520+
__ cmpptr(Address(r15_thread, Thread::pending_exception_offset()), (int32_t) NULL_WORD);
521521
__ jcc(Assembler::notEqual, L);
522522
__ stop("StubRoutines::forward exception: no pending exception (1)");
523523
__ bind(L);

src/hotspot/share/gc/shenandoah/shenandoahBarrierSet.inline.hpp

+2-2
Original file line numberDiff line numberDiff line change
@@ -205,7 +205,7 @@ inline oop ShenandoahBarrierSet::oop_cmpxchg(DecoratorSet decorators, T* addr, o
205205

206206
// Note: We don't need a keep-alive-barrier here. We already enqueue any loaded reference for SATB anyway,
207207
// because it must be the previous value.
208-
res = load_reference_barrier(decorators, res, reinterpret_cast<T*>(NULL));
208+
res = load_reference_barrier(decorators, res, static_cast<T*>(nullptr));
209209
satb_enqueue(res);
210210
return res;
211211
}
@@ -216,7 +216,7 @@ inline oop ShenandoahBarrierSet::oop_xchg(DecoratorSet decorators, T* addr, oop
216216
oop previous = RawAccess<>::oop_atomic_xchg(addr, new_value);
217217
// Note: We don't need a keep-alive-barrier here. We already enqueue any loaded reference for SATB anyway,
218218
// because it must be the previous value.
219-
previous = load_reference_barrier<T>(decorators, previous, reinterpret_cast<T*>(NULL));
219+
previous = load_reference_barrier<T>(decorators, previous, static_cast<T*>(nullptr));
220220
satb_enqueue(previous);
221221
return previous;
222222
}

src/hotspot/share/oops/access.hpp

+6-6
Original file line numberDiff line numberDiff line change
@@ -295,16 +295,16 @@ class ArrayAccess: public HeapAccess<IS_ARRAY | decorators> {
295295
static inline void arraycopy(arrayOop src_obj, size_t src_offset_in_bytes,
296296
arrayOop dst_obj, size_t dst_offset_in_bytes,
297297
size_t length) {
298-
AccessT::arraycopy(src_obj, src_offset_in_bytes, reinterpret_cast<const T*>(NULL),
299-
dst_obj, dst_offset_in_bytes, reinterpret_cast<T*>(NULL),
298+
AccessT::arraycopy(src_obj, src_offset_in_bytes, static_cast<const T*>(nullptr),
299+
dst_obj, dst_offset_in_bytes, static_cast<T*>(nullptr),
300300
length);
301301
}
302302

303303
template <typename T>
304304
static inline void arraycopy_to_native(arrayOop src_obj, size_t src_offset_in_bytes,
305305
T* dst,
306306
size_t length) {
307-
AccessT::arraycopy(src_obj, src_offset_in_bytes, reinterpret_cast<const T*>(NULL),
307+
AccessT::arraycopy(src_obj, src_offset_in_bytes, static_cast<const T*>(nullptr),
308308
NULL, 0, dst,
309309
length);
310310
}
@@ -314,15 +314,15 @@ class ArrayAccess: public HeapAccess<IS_ARRAY | decorators> {
314314
arrayOop dst_obj, size_t dst_offset_in_bytes,
315315
size_t length) {
316316
AccessT::arraycopy(NULL, 0, src,
317-
dst_obj, dst_offset_in_bytes, reinterpret_cast<T*>(NULL),
317+
dst_obj, dst_offset_in_bytes, static_cast<T*>(nullptr),
318318
length);
319319
}
320320

321321
static inline bool oop_arraycopy(arrayOop src_obj, size_t src_offset_in_bytes,
322322
arrayOop dst_obj, size_t dst_offset_in_bytes,
323323
size_t length) {
324-
return AccessT::oop_arraycopy(src_obj, src_offset_in_bytes, reinterpret_cast<const HeapWord*>(NULL),
325-
dst_obj, dst_offset_in_bytes, reinterpret_cast<HeapWord*>(NULL),
324+
return AccessT::oop_arraycopy(src_obj, src_offset_in_bytes, static_cast<const HeapWord*>(nullptr),
325+
dst_obj, dst_offset_in_bytes, static_cast<HeapWord*>(nullptr),
326326
length);
327327
}
328328

src/hotspot/share/runtime/objectMonitor.cpp

+1-1
Original file line numberDiff line numberDiff line change
@@ -668,7 +668,7 @@ const char* ObjectMonitor::is_busy_to_string(stringStream* ss) {
668668
} else {
669669
// We report NULL instead of DEFLATER_MARKER here because is_busy()
670670
// ignores DEFLATER_MARKER values.
671-
ss->print("owner=" INTPTR_FORMAT, NULL);
671+
ss->print("owner=" INTPTR_FORMAT, NULL_WORD);
672672
}
673673
ss->print(", cxq=" INTPTR_FORMAT ", EntryList=" INTPTR_FORMAT, p2i(_cxq),
674674
p2i(_EntryList));

0 commit comments

Comments
 (0)