Uploaded image for project: 'JDK'
  1. JDK
  2. JDK-8345873

Aarch64: several -Wstringop-overflow gcc14 warnings

XMLWordPrintable

    • Icon: Bug Bug
    • Resolution: Unresolved
    • Icon: P4 P4
    • 25
    • 25
    • hotspot
    • aarch64
    • linux

      There are 3 files instanceKlass/javaThread/jvmtiRawMonitor report compile warings by gcc14 on linux-aarch64 with fastdebug configure, such like:

      In file included from src/hotspot/share/runtime/atomic.hpp:862,
                       from src/hotspot/share/oops/oop.hpp:35,
                       from src/hotspot/share/oops/weakHandle.hpp:28,
                       from src/hotspot/share/classfile/classLoaderData.hpp:30,
                       from src/hotspot/share/precompiled/precompiled.hpp:34:
      In member function ‘T Atomic::PlatformOrderedLoad<byte_size, X_ACQUIRE>::operator()(const volatile T*) const [with T = unsigned char; long unsigned int byte_size = 1]’,
          inlined from ‘T Atomic::LoadImpl<T, PlatformOp, typename std::enable_if<PrimitiveConversions::Translate<T>::value, void>::type>::operator()(const volatile T*) const [with T = InstanceKlass::ClassState; PlatformOp = Atomic::PlatformOrderedLoad<1, X_ACQUIRE>]’ at src/hotspot/share/runtime/atomic.hpp:537:34,
          inlined from ‘static T Atomic::load_acquire(const volatile T*) [with T = InstanceKlass::ClassState]’ at src/hotspot/share/runtime/atomic.hpp:887:67,
          inlined from ‘InstanceKlass::ClassState InstanceKlass::init_state() const’ at src/hotspot/share/oops/instanceKlass.hpp:520:73,
          inlined from ‘bool InstanceKlass::is_being_initialized() const’ at src/hotspot/share/oops/instanceKlass.hpp:517:63,
          inlined from ‘void InstanceKlass::initialize_impl(JavaThread*)’ at src/hotspot/share/oops/instanceKlass.cpp:1183:32:
      src/hotspot/os_cpu/linux_aarch64/atomic_linux_aarch64.hpp:203:66: error: ‘unsigned char __atomic_load_1(const volatile void*, int)’ writing 1 byte into a region of size 0 overflows the destination [-Werror=stringop-overflow=]
        203 | T operator()(const volatile T* p) const { T data; __atomic_load(const_cast<T*>(p), &data, __ATOMIC_ACQUIRE); return data; }
            | ~~~~~~~~~~~~~^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
      In member function ‘void InstanceKlass::initialize_impl(JavaThread*)’:
      cc1plus: note: destination object is likely at address zero
      cc1plus: all warnings being treated as errors


      Standalone compile command:
      g++ -MMD -MF build/linux-aarch64-server-fastdebug/hotspot/variant-server/libjvm/objs/instanceKlass.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/instanceKlass.o src/hotspot/share/oops/instanceKlass.cpp -frandom-seed="instanceKlass.cpp"

            syan Sendao Yan
            syan Sendao Yan
            Votes:
            0 Vote for this issue
            Watchers:
            4 Start watching this issue

              Created:
              Updated: