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 compile log:
In file included from /usr/include/unistd.h:1182,
from src/hotspot/os/posix/include/jvm_md.h:36,
from src/hotspot/share/runtime/os.hpp:28,
from src/hotspot/share/runtime/thread.hpp:35,
from src/hotspot/share/runtime/javaThread.hpp:43,
from src/hotspot/share/oops/instanceKlass.hpp:36,
from src/hotspot/share/classfile/javaClasses.hpp:29,
from src/hotspot/share/precompiled/precompiled.hpp:35:
In function ‘ssize_t read(int, void*, size_t)’,
inlined from ‘bool read_fully(const char*, char*, size_t)’ at src/hotspot/os_cpu/linux_aarch64/vm_version_linux_aarch64.cpp:188:29,
inlined from ‘static void VM_Version::get_compatible_board(char*, int)’ at src/hotspot/os_cpu/linux_aarch64/vm_version_linux_aarch64.cpp:218:19:
/usr/include/bits/unistd.h:46:23: error: argument 2 is null but the corresponding size argument 3 value is [1, 18446744073709551615] [-Werror=nonnull]
46 | return __read_alias (__fd, __buf, __nbytes);
| ~~~~~~~~~~~~~^~~~~~~~~~~~~~~~~~~~~~~
In file included from /usr/include/features.h:465,
from /usr/include/bits/libc-header-start.h:33,
from /usr/include/stdint.h:26,
from /home/yansendao/software/gcc/gcc-14.2.0-binary/lib/gcc/aarch64-unknown-linux-gnu/14.2.0/include/stdint.h:9,
from src/hotspot/share/utilities/debug.hpp:33,
from src/hotspot/share/utilities/globalDefinitions.hpp:29,
from src/hotspot/share/nmt/memTag.hpp:28,
from src/hotspot/share/memory/allocation.hpp:29,
from src/hotspot/share/classfile/classLoaderData.hpp:28,
from src/hotspot/share/precompiled/precompiled.hpp:34:
/usr/include/bits/unistd.h: In static member function ‘static void VM_Version::get_compatible_board(char*, int)’:
/usr/include/bits/unistd.h:26:16: note: in a call to function ‘ssize_t __read_alias(int, void*, size_t)’ declared with attribute ‘access (write_only, 2, 3)’
26 | extern ssize_t __REDIRECT (__read_alias, (int __fd, void *__buf,
| ^~~~~~~~~~
cc1plus: all warnings being treated as errors
Standalone compile command:
g++ -MMD -MF build/linux-aarch64-server-fastdebug/hotspot/variant-server/libjvm/objs/vm_version_linux_aarch64.d.tmp -fpch-preprocess -Ibuild/linux-aarch64-server-fastdebug/hotspot/variant-server/libjvm/objs/precompiled -D__STDC_FORMAT_MACROS -D__STDC_LIMIT_MACROS -D__STDC_CONSTANT_MACROS -D_GNU_SOURCE -D_REENTRANT -pipe -fno-rtti -fno-exceptions -fvisibility=hidden -fno-strict-aliasing -fno-omit-frame-pointer -fstack-protector -std=c++14 -DLIBC=gnu -DLINUX -D_FILE_OFFSET_BITS=64 -Wall -Wextra -Wformat=2 -Wpointer-arith -Wreturn-type -Wsign-compare -Wtrampolines -Wundef -Wunused-const-variable=1 -Wunused-function -Wunused-result -Wunused-value -Woverloaded-virtual -Wreorder -fPIC -DVM_LITTLE_ENDIAN -D_LP64=1 -Wno-psabi -fno-lifetime-dse -Wno-format-zero-length -Wtype-limits -Wuninitialized -fsanitize=address -Wno-stringop-truncation -fno-omit-frame-pointer -fno-common -DADDRESS_SANITIZER --param asan-use-after-return=0 -fsanitize=undefined -fsanitize=float-divide-by-zero -fno-sanitize=shift-base -fno-sanitize=alignment -Wno-stringop-truncation -Wno-format-overflow -fno-omit-frame-pointer -DUNDEFINED_BEHAVIOR_SANITIZER -fsanitize=leak -fno-omit-frame-pointer -DLEAK_SANITIZER -DASSERT -DCHECK_UNHANDLED_OOPS -DTARGET_ARCH_aarch64 -DINCLUDE_SUFFIX_OS=_linux -DINCLUDE_SUFFIX_CPU=_aarch64 -DINCLUDE_SUFFIX_COMPILER=_gcc -DTARGET_COMPILER_gcc -DAARCH64 '-DHOTSPOT_LIB_ARCH="aarch64"' -DCOMPILER1 -DCOMPILER2 -DDTRACE_ENABLED -Ibuild/linux-aarch64-server-fastdebug/hotspot/variant-server/gensrc/adfiles -Isrc/hotspot/share -Isrc/hotspot/os/linux -Isrc/hotspot/os/posix -Isrc/hotspot/cpu/aarch64 -Isrc/hotspot/os_cpu/linux_aarch64 -Ibuild/linux-aarch64-server-fastdebug/hotspot/variant-server/gensrc -Isrc/hotspot/share/precompiled -Isrc/hotspot/share/include -Isrc/hotspot/os/posix/include -Ibuild/linux-aarch64-server-fastdebug/support/modules_include/java.base -Ibuild/linux-aarch64-server-fastdebug/support/modules_include/java.base/linux -Isrc/java.base/share/native/libjimage -DCOMPATIBLE_CDS_ALIGNMENT -Ibuild/linux-aarch64-server-fastdebug/hotspot/variant-server/gensrc/adfiles -Isrc/hotspot/share -Isrc/hotspot/os/linux -Isrc/hotspot/os/posix -Isrc/hotspot/cpu/aarch64 -Isrc/hotspot/os_cpu/linux_aarch64 -Ibuild/linux-aarch64-server-fastdebug/hotspot/variant-server/gensrc -Ibuild/linux-aarch64-server-fastdebug/support/modules_include/java.base -Isrc/java.base/unix/native/include -Isrc/java.base/share/native/include -g -gdwarf-4 -Wno-unused-parameter -Wno-array-bounds -Wno-comment -Wno-delete-non-virtual-dtor -Wno-empty-body -Wno-implicit-fallthrough -Wno-int-in-bool-context -Wno-maybe-uninitialized -Wno-missing-field-initializers -Wno-shift-negative-value -Wno-unknown-pragmas -Wno-unused-but-set-variable -Wno-unused-local-typedefs -Wno-unused-variable -Wno-strict-overflow -Werror -O3 -D_FORTIFY_SOURCE=2 -c -o build/linux-aarch64-server-fastdebug/hotspot/variant-server/libjvm/objs/vm_version_linux_aarch64.o src/hotspot/os_cpu/linux_aarch64/vm_version_linux_aarch64.cpp -frandom-seed=vm_version_linux_aarch64.cpp
gcc version:
> gcc -v
Using built-in specs.
COLLECT_GCC=gcc
COLLECT_LTO_WRAPPER=/home/yansendao/software/gcc/gcc-14.2.0-binary/bin/../libexec/gcc/aarch64-unknown-linux-gnu/14.2.0/lto-wrapper
Target: aarch64-unknown-linux-gnu
Configured with: configure --prefix=/home/yansendao/tone/tone-matrix-compiler/csmith/gcc-14.2.0-binary --disable-multilib --enable-languages=c,c++,objc,obj-c++,fortran,lto
Thread model: posix
Supported LTO compression algorithms: zlib zstd
gcc version 14.2.0 (GCC)
The compile log:
In file included from /usr/include/unistd.h:1182,
from src/hotspot/os/posix/include/jvm_md.h:36,
from src/hotspot/share/runtime/os.hpp:28,
from src/hotspot/share/runtime/thread.hpp:35,
from src/hotspot/share/runtime/javaThread.hpp:43,
from src/hotspot/share/oops/instanceKlass.hpp:36,
from src/hotspot/share/classfile/javaClasses.hpp:29,
from src/hotspot/share/precompiled/precompiled.hpp:35:
In function ‘ssize_t read(int, void*, size_t)’,
inlined from ‘bool read_fully(const char*, char*, size_t)’ at src/hotspot/os_cpu/linux_aarch64/vm_version_linux_aarch64.cpp:188:29,
inlined from ‘static void VM_Version::get_compatible_board(char*, int)’ at src/hotspot/os_cpu/linux_aarch64/vm_version_linux_aarch64.cpp:218:19:
/usr/include/bits/unistd.h:46:23: error: argument 2 is null but the corresponding size argument 3 value is [1, 18446744073709551615] [-Werror=nonnull]
46 | return __read_alias (__fd, __buf, __nbytes);
| ~~~~~~~~~~~~~^~~~~~~~~~~~~~~~~~~~~~~
In file included from /usr/include/features.h:465,
from /usr/include/bits/libc-header-start.h:33,
from /usr/include/stdint.h:26,
from /home/yansendao/software/gcc/gcc-14.2.0-binary/lib/gcc/aarch64-unknown-linux-gnu/14.2.0/include/stdint.h:9,
from src/hotspot/share/utilities/debug.hpp:33,
from src/hotspot/share/utilities/globalDefinitions.hpp:29,
from src/hotspot/share/nmt/memTag.hpp:28,
from src/hotspot/share/memory/allocation.hpp:29,
from src/hotspot/share/classfile/classLoaderData.hpp:28,
from src/hotspot/share/precompiled/precompiled.hpp:34:
/usr/include/bits/unistd.h: In static member function ‘static void VM_Version::get_compatible_board(char*, int)’:
/usr/include/bits/unistd.h:26:16: note: in a call to function ‘ssize_t __read_alias(int, void*, size_t)’ declared with attribute ‘access (write_only, 2, 3)’
26 | extern ssize_t __REDIRECT (__read_alias, (int __fd, void *__buf,
| ^~~~~~~~~~
cc1plus: all warnings being treated as errors
Standalone compile command:
g++ -MMD -MF build/linux-aarch64-server-fastdebug/hotspot/variant-server/libjvm/objs/vm_version_linux_aarch64.d.tmp -fpch-preprocess -Ibuild/linux-aarch64-server-fastdebug/hotspot/variant-server/libjvm/objs/precompiled -D__STDC_FORMAT_MACROS -D__STDC_LIMIT_MACROS -D__STDC_CONSTANT_MACROS -D_GNU_SOURCE -D_REENTRANT -pipe -fno-rtti -fno-exceptions -fvisibility=hidden -fno-strict-aliasing -fno-omit-frame-pointer -fstack-protector -std=c++14 -DLIBC=gnu -DLINUX -D_FILE_OFFSET_BITS=64 -Wall -Wextra -Wformat=2 -Wpointer-arith -Wreturn-type -Wsign-compare -Wtrampolines -Wundef -Wunused-const-variable=1 -Wunused-function -Wunused-result -Wunused-value -Woverloaded-virtual -Wreorder -fPIC -DVM_LITTLE_ENDIAN -D_LP64=1 -Wno-psabi -fno-lifetime-dse -Wno-format-zero-length -Wtype-limits -Wuninitialized -fsanitize=address -Wno-stringop-truncation -fno-omit-frame-pointer -fno-common -DADDRESS_SANITIZER --param asan-use-after-return=0 -fsanitize=undefined -fsanitize=float-divide-by-zero -fno-sanitize=shift-base -fno-sanitize=alignment -Wno-stringop-truncation -Wno-format-overflow -fno-omit-frame-pointer -DUNDEFINED_BEHAVIOR_SANITIZER -fsanitize=leak -fno-omit-frame-pointer -DLEAK_SANITIZER -DASSERT -DCHECK_UNHANDLED_OOPS -DTARGET_ARCH_aarch64 -DINCLUDE_SUFFIX_OS=_linux -DINCLUDE_SUFFIX_CPU=_aarch64 -DINCLUDE_SUFFIX_COMPILER=_gcc -DTARGET_COMPILER_gcc -DAARCH64 '-DHOTSPOT_LIB_ARCH="aarch64"' -DCOMPILER1 -DCOMPILER2 -DDTRACE_ENABLED -Ibuild/linux-aarch64-server-fastdebug/hotspot/variant-server/gensrc/adfiles -Isrc/hotspot/share -Isrc/hotspot/os/linux -Isrc/hotspot/os/posix -Isrc/hotspot/cpu/aarch64 -Isrc/hotspot/os_cpu/linux_aarch64 -Ibuild/linux-aarch64-server-fastdebug/hotspot/variant-server/gensrc -Isrc/hotspot/share/precompiled -Isrc/hotspot/share/include -Isrc/hotspot/os/posix/include -Ibuild/linux-aarch64-server-fastdebug/support/modules_include/java.base -Ibuild/linux-aarch64-server-fastdebug/support/modules_include/java.base/linux -Isrc/java.base/share/native/libjimage -DCOMPATIBLE_CDS_ALIGNMENT -Ibuild/linux-aarch64-server-fastdebug/hotspot/variant-server/gensrc/adfiles -Isrc/hotspot/share -Isrc/hotspot/os/linux -Isrc/hotspot/os/posix -Isrc/hotspot/cpu/aarch64 -Isrc/hotspot/os_cpu/linux_aarch64 -Ibuild/linux-aarch64-server-fastdebug/hotspot/variant-server/gensrc -Ibuild/linux-aarch64-server-fastdebug/support/modules_include/java.base -Isrc/java.base/unix/native/include -Isrc/java.base/share/native/include -g -gdwarf-4 -Wno-unused-parameter -Wno-array-bounds -Wno-comment -Wno-delete-non-virtual-dtor -Wno-empty-body -Wno-implicit-fallthrough -Wno-int-in-bool-context -Wno-maybe-uninitialized -Wno-missing-field-initializers -Wno-shift-negative-value -Wno-unknown-pragmas -Wno-unused-but-set-variable -Wno-unused-local-typedefs -Wno-unused-variable -Wno-strict-overflow -Werror -O3 -D_FORTIFY_SOURCE=2 -c -o build/linux-aarch64-server-fastdebug/hotspot/variant-server/libjvm/objs/vm_version_linux_aarch64.o src/hotspot/os_cpu/linux_aarch64/vm_version_linux_aarch64.cpp -frandom-seed=vm_version_linux_aarch64.cpp
gcc version:
> gcc -v
Using built-in specs.
COLLECT_GCC=gcc
COLLECT_LTO_WRAPPER=/home/yansendao/software/gcc/gcc-14.2.0-binary/bin/../libexec/gcc/aarch64-unknown-linux-gnu/14.2.0/lto-wrapper
Target: aarch64-unknown-linux-gnu
Configured with: configure --prefix=/home/yansendao/tone/tone-matrix-compiler/csmith/gcc-14.2.0-binary --disable-multilib --enable-languages=c,c++,objc,obj-c++,fortran,lto
Thread model: posix
Supported LTO compression algorithms: zlib zstd
gcc version 14.2.0 (GCC)
- duplicates
-
JDK-8339331 GCC fortify error in vm_version_linux_aarch64.cpp
-
- Resolved
-
- relates to
-
JDK-8262491 AArch64: CPU description should contain compatible board list
-
- Resolved
-