From 842f801c845ec4bb6a3433fa2790f98864ca330b Mon Sep 17 00:00:00 2001 From: SendaoYan Date: Wed, 18 Dec 2024 06:35:28 +0000 Subject: [PATCH] 8339331: GCC fortify error in vm_version_linux_aarch64.cpp Reviewed-by: dholmes --- .../os_cpu/linux_aarch64/vm_version_linux_aarch64.cpp | 9 ++++++++- 1 file changed, 8 insertions(+), 1 deletion(-) diff --git a/src/hotspot/os_cpu/linux_aarch64/vm_version_linux_aarch64.cpp b/src/hotspot/os_cpu/linux_aarch64/vm_version_linux_aarch64.cpp index 53e5631fc2b..6102f70f06b 100644 --- a/src/hotspot/os_cpu/linux_aarch64/vm_version_linux_aarch64.cpp +++ b/src/hotspot/os_cpu/linux_aarch64/vm_version_linux_aarch64.cpp @@ -1,5 +1,5 @@ /* - * Copyright (c) 2006, 2023, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2006, 2024, Oracle and/or its affiliates. All rights reserved. * Copyright (c) 2014, 2020, Red Hat Inc. All rights reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * @@ -185,7 +185,14 @@ static bool read_fully(const char *fname, char *buf, size_t buflen) { assert(buflen >= 1, "invalid argument"); int fd = os::open(fname, O_RDONLY, 0); if (fd != -1) { + PRAGMA_DIAG_PUSH + PRAGMA_NONNULL_IGNORED + // Suppress false positive gcc warning, which may be an example of + // https://gcc.gnu.org/bugzilla/show_bug.cgi?id=87489 + // The warning also hasn't been seen with vanilla gcc release, so may also + // involve some distro-specific gcc patch. ssize_t read_sz = ::read(fd, buf, buflen); + PRAGMA_DIAG_POP ::close(fd); // Skip if the contents is just "\n" because some machine only sets