1 Star 0 Fork 81

Alex Gao/openjdk-1.8.0

加入 Gitee
与超过 1200万 开发者一起发现、参与优秀开源项目,私有仓库也完全免费 :)
免费加入
文件
克隆/下载
fix-GCC-12-build-jdk8-fastdebug-error.patch 1.63 KB
一键复制 编辑 原始数据 按行查看 历史
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
马建仓 AI 助手
尝试更多
代码解读
代码找茬
代码优化
1
https://gitee.com/gaoxiang90/openjdk-1.8.0.git
git@gitee.com:gaoxiang90/openjdk-1.8.0.git
gaoxiang90
openjdk-1.8.0
openjdk-1.8.0
master

搜索帮助