Skip to content

Commit 20a6dfe

Browse files
committed
8319818: Address GCC 13.2.0 warnings (stringop-overflow and dangling-pointer)
Backport-of: c0507af5a4d867940b3aee1ac0fc8188b5536825
1 parent 87fb2fa commit 20a6dfe

File tree

3 files changed

+22
-13
lines changed

3 files changed

+22
-13
lines changed

make/hotspot/lib/CompileJvm.gmk

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -87,6 +87,13 @@ ifeq ($(call check-jvm-feature, zero), true)
8787
DISABLED_WARNINGS_gcc += return-type switch clobbered
8888
endif
8989

90+
ifeq ($(DEBUG_LEVEL), fastdebug)
91+
ifeq ($(call And, $(call isTargetOs, linux) $(call isTargetCpu, aarch64)), true)
92+
# False positive warnings for atomic_linux_aarch64.hpp on GCC >= 13
93+
DISABLED_WARNINGS_gcc += stringop-overflow
94+
endif
95+
endif
96+
9097
DISABLED_WARNINGS_clang := tautological-compare \
9198
undefined-var-template sometimes-uninitialized unknown-pragmas \
9299
delete-non-virtual-dtor missing-braces char-subscripts \

src/hotspot/share/memory/resourceArea.cpp

Lines changed: 13 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
/*
2-
* Copyright (c) 1997, 2020, 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
@@ -42,6 +42,18 @@ void ResourceArea::bias_to(MEMFLAGS new_flags) {
4242

4343
#ifdef ASSERT
4444

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

src/hotspot/share/memory/resourceArea.hpp

Lines changed: 2 additions & 12 deletions
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
@@ -195,17 +195,7 @@ class ResourceMark: public StackObj {
195195
#ifndef ASSERT
196196
ResourceMark(ResourceArea* area, Thread* thread) : _impl(area) {}
197197
#else
198-
ResourceMark(ResourceArea* area, Thread* thread) :
199-
_impl(area),
200-
_thread(thread),
201-
_previous_resource_mark(nullptr)
202-
{
203-
if (_thread != nullptr) {
204-
assert(_thread == Thread::current(), "not the current thread");
205-
_previous_resource_mark = _thread->current_resource_mark();
206-
_thread->set_current_resource_mark(this);
207-
}
208-
}
198+
ResourceMark(ResourceArea* area, Thread* thread);
209199
#endif // ASSERT
210200

211201
public:

0 commit comments

Comments
 (0)