Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

8291633: Build failures with GCC 11, Alpine 3 due to incompatible casts from nullptr #9705

Closed
wants to merge 4 commits into from
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
2 changes: 1 addition & 1 deletion src/hotspot/cpu/x86/interp_masm_x86.cpp
Expand Up @@ -1122,7 +1122,7 @@ void InterpreterMacroAssembler::remove_activation(

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()), (int32_t) NULL_WORD);
jcc(Assembler::notEqual, exception);

addptr(rmon, entry_size); // otherwise advance to next entry
Expand Down
10 changes: 5 additions & 5 deletions src/hotspot/cpu/x86/interpreterRT_x86_64.cpp
@@ -1,5 +1,5 @@
/*
* Copyright (c) 2003, 2019, Oracle and/or its affiliates. All rights reserved.
* Copyright (c) 2003, 2022, Oracle and/or its affiliates. All rights reserved.
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
*
* This code is free software; you can redistribute it and/or modify it
Expand Down Expand Up @@ -348,10 +348,10 @@ class SlowSignatureHandler
intptr_t *from_addr = (intptr_t*)(_from + Interpreter::local_offset_in_bytes(0));
_from -= Interpreter::stackElementSize;
if (_num_args < Argument::n_int_register_parameters_c-1) {
*_reg_args++ = (*from_addr == 0) ? NULL : (intptr_t) from_addr;
*_reg_args++ = (*from_addr == 0) ? NULL_WORD : (intptr_t) from_addr;
_num_args++;
} else {
*_to++ = (*from_addr == 0) ? NULL : (intptr_t) from_addr;
*_to++ = (*from_addr == 0) ? NULL_WORD : (intptr_t) from_addr;
}
}

Expand Down Expand Up @@ -443,10 +443,10 @@ class SlowSignatureHandler
_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) ? NULL_WORD : (intptr_t)from_addr;
_num_int_args++;
} else {
*_to++ = (*from_addr == 0) ? NULL : (intptr_t) from_addr;
*_to++ = (*from_addr == 0) ? NULL_WORD : (intptr_t) from_addr;
}
}

Expand Down
2 changes: 1 addition & 1 deletion src/hotspot/cpu/x86/stubGenerator_x86_64.cpp
Expand Up @@ -529,7 +529,7 @@ class StubGenerator: public StubCodeGenerator {
// make sure this code is only executed if there is a pending exception
{
Label L;
__ cmpptr(Address(r15_thread, Thread::pending_exception_offset()), (int32_t) NULL);
__ cmpptr(Address(r15_thread, Thread::pending_exception_offset()), (int32_t) NULL_WORD);
__ jcc(Assembler::notEqual, L);
__ stop("StubRoutines::forward exception: no pending exception (1)");
__ bind(L);
Expand Down
Expand Up @@ -200,7 +200,7 @@ inline oop ShenandoahBarrierSet::oop_cmpxchg(DecoratorSet decorators, T* addr, o

// Note: We don't need a keep-alive-barrier here. We already enqueue any loaded reference for SATB anyway,
// because it must be the previous value.
res = load_reference_barrier(decorators, res, reinterpret_cast<T*>(NULL));
res = load_reference_barrier(decorators, res, static_cast<T*>(nullptr));
satb_enqueue(res);
return res;
}
Expand All @@ -211,7 +211,7 @@ inline oop ShenandoahBarrierSet::oop_xchg(DecoratorSet decorators, T* addr, oop
oop previous = RawAccess<>::oop_atomic_xchg(addr, new_value);
// Note: We don't need a keep-alive-barrier here. We already enqueue any loaded reference for SATB anyway,
// because it must be the previous value.
previous = load_reference_barrier<T>(decorators, previous, reinterpret_cast<T*>(NULL));
previous = load_reference_barrier<T>(decorators, previous, static_cast<T*>(nullptr));
satb_enqueue(previous);
return previous;
}
Expand Down
12 changes: 6 additions & 6 deletions src/hotspot/share/oops/access.hpp
Expand Up @@ -294,16 +294,16 @@ class ArrayAccess: public HeapAccess<IS_ARRAY | decorators> {
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*>(nullptr),
dst_obj, dst_offset_in_bytes, static_cast<T*>(nullptr),
length);
}

template <typename T>
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*>(nullptr),
NULL, 0, dst,
length);
}
Expand All @@ -313,15 +313,15 @@ class ArrayAccess: public HeapAccess<IS_ARRAY | decorators> {
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*>(nullptr),
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*>(nullptr),
dst_obj, dst_offset_in_bytes, static_cast<HeapWord*>(nullptr),
length);
}

Expand Down
2 changes: 1 addition & 1 deletion src/hotspot/share/runtime/objectMonitor.cpp
Expand Up @@ -668,7 +668,7 @@ const char* ObjectMonitor::is_busy_to_string(stringStream* ss) {
} else {
// We report NULL instead of DEFLATER_MARKER here because is_busy()
// ignores DEFLATER_MARKER values.
ss->print("owner=" INTPTR_FORMAT, NULL);
ss->print("owner=" INTPTR_FORMAT, NULL_WORD);
}
ss->print(", cxq=" INTPTR_FORMAT ", EntryList=" INTPTR_FORMAT, p2i(_cxq),
p2i(_EntryList));
Expand Down