RFR: 8345758: AArch64: vm_version_linux_aarch64.cpp report nullptr compile warning by gcc14

SendaoYan syan at openjdk.org
Tue Dec 10 03:49:19 UTC 2024


Hi all,
The file src/hotspot/os_cpu/linux_aarch64/vm_version_linux_aarch64.cpp report nullptr compile warning by gcc14 with fastdebug configure. I think it's false positive, since the statement 'assert(buf != nullptr, "invalid argument");' has make sure the buf should not be nullptr before execute '::read(int, void*, int)'. The call chain is `void VM_Version::initialize_cpu_information(void)` -> `void VM_Version::get_compatible_board(char *buf, int buflen)` -> `static bool read_fully(const char *fname, char *buf, size_t buflen)`, `*buf` is defined as `char  Abstract_VM_Version::_cpu_desc[4096] = {0};` and then right shift 8 bytes, so `*buf` should not be nullptr.
This PR use suppression pragma macro `PRAGMA_DISABLE_GCC_WARNING("-Wnonnull")` to disable false positive gcc compile warning to make fastdebug configure make success on linux-aarch64 by gcc14.2.0.
Risk is low.

Additional testing:

- [ ]  jtreg tests(include tier1/2/3) on linux-x64 with release build
- [ ]  jtreg tests(include tier1/2/3) on linux-x64 with fastdebug build
- [ ]  jtreg tests(include tier1/2/3) on linux-aarch64 with release build
- [ ]  jtreg tests(include tier1/2/3) on linux-aarch64 with fastdebug build

-------------

Commit messages:
 - update copyright year to 2024
 - 8345758: AArch64: vm_version_linux_aarch64.cpp report nullptr compile warning by gcc14

Changes: https://git.openjdk.org/jdk/pull/22655/files
  Webrev: https://webrevs.openjdk.org/?repo=jdk&pr=22655&range=00
  Issue: https://bugs.openjdk.org/browse/JDK-8345758
  Stats: 4 lines in 1 file changed: 3 ins; 0 del; 1 mod
  Patch: https://git.openjdk.org/jdk/pull/22655.diff
  Fetch: git fetch https://git.openjdk.org/jdk.git pull/22655/head:pull/22655

PR: https://git.openjdk.org/jdk/pull/22655


More information about the hotspot-runtime-dev mailing list