!538 I9DJSJ: Fix GCC 12 build jdk8 fastdebug error

From: @kuenking111 
Reviewed-by: @alexanderbill 
Signed-off-by: @alexanderbill
This commit is contained in:
openeuler-ci-bot 2024-04-02 06:47:30 +00:00 committed by Gitee
commit 45a9397d5f
No known key found for this signature in database
GPG Key ID: 173E9B9CA92EEF8F
2 changed files with 51 additions and 1 deletions

View File

@ -0,0 +1,45 @@
Subject: Fix GCC 12 build jdk8 fastdebug error
---
.../vm/gc_implementation/g1/concurrentMark.cpp | 13 ++++++++++++-
1 file changed, 12 insertions(+), 1 deletion(-)
diff --git a/hotspot/src/share/vm/gc_implementation/g1/concurrentMark.cpp b/hotspot/src/share/vm/gc_implementation/g1/concurrentMark.cpp
index df901a52d..1347a7e16 100644
--- a/hotspot/src/share/vm/gc_implementation/g1/concurrentMark.cpp
+++ b/hotspot/src/share/vm/gc_implementation/g1/concurrentMark.cpp
@@ -2914,13 +2914,23 @@ void ConcurrentMark::print_reachable(const char* str,
return;
}
- char file_name[JVM_MAXPATHLEN];
+ // fix gcc 12 build jdk8 fastdebug compiler error:
+ // directive writing up to 4096 bytes into a region of size between 0 and 4096 [-Werror=format-overflow=]
+ // about old code:
+ // char file_name[JVM_MAXPATHLEN];
+ // Leave L 2911~2915 code unchanged, so not affect original logic.
+ char *file_name = (char *) NEW_C_HEAP_ARRAY(char, strlen(G1PrintReachableBaseFile) + 2 + strlen(str), mtGC);
+ if (NULL == file_name) {
+ gclog_or_tty->print_cr(" #### error: NEW_C_HEAP_ARRAY failed.");
+ return;
+ }
sprintf(file_name, "%s.%s", G1PrintReachableBaseFile, str);
gclog_or_tty->print_cr(" dumping to file %s", file_name);
fileStream fout(file_name);
if (!fout.is_open()) {
gclog_or_tty->print_cr(" #### error: could not open file");
+ FREE_C_HEAP_ARRAY(char, file_name, mtGC);
return;
}
@@ -2936,6 +2946,7 @@ void ConcurrentMark::print_reachable(const char* str,
gclog_or_tty->print_cr(" done");
gclog_or_tty->flush();
+ FREE_C_HEAP_ARRAY(char, file_name, mtGC);
}
#endif // PRODUCT
--
2.22.0

View File

@ -936,7 +936,7 @@ Provides: java-%{javaver}-%{origin}-accessibility%{?1} = %{epoch}:%{version}-%{r
Name: java-%{javaver}-%{origin}
Version: %{javaver}.%{updatever}.%{buildver}
Release: 4
Release: 5
# java-1.5.0-ibm from jpackage.org set Epoch to 1 for unknown reasons
# and this change was brought into RHEL-4. java-1.5.0-ibm packages
# also included the epoch in their virtual provides. This created a
@ -1317,6 +1317,7 @@ Patch422: 8149343-assert-rp-num_q-no_of_gc_workers-failed-sani.patch
Patch423: 8139595-MethodHandles-remove_dependent_nmethod-is-no.patch
Patch424: 8143408-Crash-during-InstanceKlass-unloading-when-cl.patch
Patch425: GCC-12-reports-some-compiler-warnings.patch
Patch426: fix-GCC-12-build-jdk8-fastdebug-error.patch
#############################################
#
@ -1959,6 +1960,7 @@ pushd %{top_level_dir_name}
%patch423 -p1
%patch424 -p1
%patch425 -p1
%patch426 -p1
%endif
%ifarch loongarch64
@ -2617,6 +2619,9 @@ cjc.mainProgram(arg)
%endif
%changelog
* Tue Apr 2 2024 kuenking111 <wangkun49@huawei.com> - 1:1.8.0.402-b06.5
- add fix-GCC-12-build-jdk8-fastdebug-error.patch
* Sat Mar 30 2024 Benshuai5D <benshuai5d@163.com> - 1:1.8.0.402-b06.4
- add 8322725-tz-Update-Timezone-Data-to-2023d.patch
- add 8325150-tz-Update-Timezone-Data-to-2024a.patch