Skip to content

Commit 6c65326

Browse files
committed
8319818: Address GCC 13.2.0 warnings (stringop-overflow and dangling-pointer)
8320212: Disable GCC stringop-overflow warning for affected files 8326717: Disable stringop-overflow in shenandoahLock.cpp Reviewed-by: mdoerr Backport-of: c0507af5a4d867940b3aee1ac0fc8188b5536825
1 parent 7ff9ec6 commit 6c65326

File tree

3 files changed

+20
-13
lines changed

3 files changed

+20
-13
lines changed

make/hotspot/lib/CompileJvm.gmk

+5
Original file line numberDiff line numberDiff line change
@@ -157,8 +157,13 @@ $(eval $(call SetupJdkLibrary, BUILD_LIBJVM, \
157157
DISABLED_WARNINGS_gcc_ad_$(HOTSPOT_TARGET_CPU_ARCH).cpp := nonnull, \
158158
DISABLED_WARNINGS_gcc_cgroupV1Subsystem_linux.cpp := address, \
159159
DISABLED_WARNINGS_gcc_cgroupV2Subsystem_linux.cpp := address, \
160+
DISABLED_WARNINGS_gcc_handshake.cpp := stringop-overflow, \
160161
DISABLED_WARNINGS_gcc_interp_masm_x86.cpp := uninitialized, \
162+
DISABLED_WARNINGS_gcc_jvmciCodeInstaller.cpp := stringop-overflow, \
163+
DISABLED_WARNINGS_gcc_jvmtiTagMap.cpp := stringop-overflow, \
161164
DISABLED_WARNINGS_gcc_postaloc.cpp := address, \
165+
DISABLED_WARNINGS_gcc_shenandoahLock.cpp := stringop-overflow, \
166+
DISABLED_WARNINGS_gcc_synchronizer.cpp := stringop-overflow, \
162167
DISABLED_WARNINGS_clang := $(DISABLED_WARNINGS_clang), \
163168
DISABLED_WARNINGS_clang_arguments.cpp := missing-field-initializers, \
164169
DISABLED_WARNINGS_clang_codeBuffer.cpp := tautological-undefined-compare, \

src/hotspot/share/memory/resourceArea.cpp

+13-1
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
/*
2-
* Copyright (c) 1997, 2022, Oracle and/or its affiliates. All rights reserved.
2+
* Copyright (c) 1997, 2023, 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
@@ -43,6 +43,18 @@ void ResourceArea::bias_to(MEMFLAGS new_flags) {
4343

4444
#ifdef ASSERT
4545

46+
ResourceMark::ResourceMark(ResourceArea* area, Thread* thread) :
47+
_impl(area),
48+
_thread(thread),
49+
_previous_resource_mark(nullptr)
50+
{
51+
if (_thread != nullptr) {
52+
assert(_thread == Thread::current(), "not the current thread");
53+
_previous_resource_mark = _thread->current_resource_mark();
54+
_thread->set_current_resource_mark(this);
55+
}
56+
}
57+
4658
void ResourceArea::verify_has_resource_mark() {
4759
if (_nesting <= 0 && !VMError::is_error_reported()) {
4860
// Only report the first occurrence of an allocating thread that

src/hotspot/share/memory/resourceArea.hpp

+2-12
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
/*
2-
* Copyright (c) 1997, 2022, Oracle and/or its affiliates. All rights reserved.
2+
* Copyright (c) 1997, 2023, 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
@@ -191,17 +191,7 @@ class ResourceMark: public StackObj {
191191
#ifndef ASSERT
192192
ResourceMark(ResourceArea* area, Thread* thread) : _impl(area) {}
193193
#else
194-
ResourceMark(ResourceArea* area, Thread* thread) :
195-
_impl(area),
196-
_thread(thread),
197-
_previous_resource_mark(nullptr)
198-
{
199-
if (_thread != nullptr) {
200-
assert(_thread == Thread::current(), "not the current thread");
201-
_previous_resource_mark = _thread->current_resource_mark();
202-
_thread->set_current_resource_mark(this);
203-
}
204-
}
194+
ResourceMark(ResourceArea* area, Thread* thread);
205195
#endif // ASSERT
206196

207197
public:

0 commit comments

Comments
 (0)