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

RISC-V: fail to build with GCC 12 due to stringop-overflow warning

XMLWordPrintable

    • Icon: Bug Bug
    • Resolution: Unresolved
    • Icon: P4 P4
    • tbd
    • 21
    • hotspot
    • riscv
    • linux

      $ /usr/bin/g++-12 -v
      Using built-in specs.
      COLLECT_GCC=g++-12
      COLLECT_LTO_WRAPPER=/usr/lib/gcc/riscv64-linux-gnu/12/lto-wrapper
      Target: riscv64-linux-gnu
      Configured with: ../src/configure -v --with-pkgversion='Ubuntu 12.1.0-2ubuntu1~22.04' --with-bugurl=file:///usr/share/doc/gcc-12/README.Bugs --enable-languages=c,ada,c++,go,d,fortran,objc,obj-c++,m2 --prefix=/usr --with-gcc-major-version-only --program-suffix=-12 --program-prefix=riscv64-linux-gnu- --enable-shared --enable-linker-build-id --libexecdir=/usr/lib --without-included-gettext --enable-threads=posix --libdir=/usr/lib --enable-nls --enable-clocale=gnu --enable-libstdcxx-debug --enable-libstdcxx-time=yes --with-default-libstdcxx-abi=new --enable-gnu-unique-object --disable-libitm --disable-libquadmath --disable-libquadmath-support --enable-plugin --enable-default-pie --with-system-zlib --enable-libphobos-checking=release --with-target-system-zlib=auto --enable-objc-gc=auto --enable-multiarch --disable-werror --disable-multilib --with-arch=rv64gc --with-abi=lp64d --enable-checking=release --build=riscv64-linux-gnu --host=riscv64-linux-gnu --target=riscv64-linux-gnu
      Thread model: posix
      Supported LTO compression algorithms: zlib zstd
      gcc version 12.1.0 (Ubuntu 12.1.0-2ubuntu1~22.04)

      OpenJDK linux-riscv64 release build warnings/errors with GCC 12:

      In file included from /home/fyang/openjdk-jdk/src/hotspot/share/runtime/atomic.hpp:612,
                       from /home/fyang/openjdk-jdk/src/hotspot/share/gc/shared/suspendibleThreadSet.hpp:29,
                       from /home/fyang/openjdk-jdk/src/hotspot/share/gc/z/zPageAllocator.cpp:26:
      In member function 'D Atomic::PlatformAdd<byte_size>::add_and_fetch(volatile D*, I, atomic_memory_order) const [with D = long unsigned int; I = long unsigned int; long unsigned int byte_size = 8]',
          inlined from 'static D Atomic::AddImpl<D, I, typename std::enable_if<(((IsIntegral<I>::value && IsIntegral<T>::value) && (sizeof (I) <= sizeof (D))) && (IsSigned<I>::value == IsSigned<T>::value)), void>::type>::add_and_fetch(volatile D*, I, atomic_memory_order) [with D = long unsigned int; I = long unsigned int]' at /home/fyang/openjdk-jdk/src/hotspot/share/runtime/atomic.hpp:686:50,
          inlined from 'static D Atomic::add(volatile D*, I, atomic_memory_order) [with D = long unsigned int; I = long unsigned int]' at /home/fyang/openjdk-jdk/src/hotspot/share/runtime/atomic.hpp:667:38,
          inlined from 'size_t ZPageAllocator::uncommit(uint64_t*)' at /home/fyang/openjdk-jdk/src/hotspot/share/gc/z/zPageAllocator.cpp:789:16:
      /home/fyang/openjdk-jdk/src/hotspot/os_cpu/linux_riscv/atomic_linux_riscv.hpp:40:31: error: 'long unsigned int __atomic_add_fetch_8(volatile void*, long unsigned int, int)' writing 8 bytes into a region of size 0 overflows the destination [-Werror=stringop-overflow=]
         40 | D res = __atomic_add_fetch(dest, add_value, __ATOMIC_RELEASE);
            | ~~~~~~~~~~~~~~~~~~^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
      cc1plus: all warnings being treated as errors
      gmake[3]: *** [lib/CompileJvm.gmk:147: /home/fyang/openjdk-jdk/build/linux-riscv64-server-release/hotspot/variant-server/libjvm/objs/zPageAllocator.o] Error 1
      gmake[3]: *** Waiting for unfinished jobs....
      gmake[2]: *** [make/Main.gmk:252: hotspot-server-libs] Error 2

      ERROR: Build failed for target 'images' in configuration 'linux-riscv64-server-release' (exit code 2)

      === Output from failing command(s) repeated here ===
      * For target hotspot_variant-server_libjvm_objs_zPageAllocator.o:
      In file included from /home/fyang/openjdk-jdk/src/hotspot/share/runtime/atomic.hpp:612,
                       from /home/fyang/openjdk-jdk/src/hotspot/share/gc/shared/suspendibleThreadSet.hpp:29,
                       from /home/fyang/openjdk-jdk/src/hotspot/share/gc/z/zPageAllocator.cpp:26:
      In member function 'D Atomic::PlatformAdd<byte_size>::add_and_fetch(volatile D*, I, atomic_memory_order) const [with D = long unsigned int; I = long unsigned int; long unsigned int byte_size = 8]',
          inlined from 'static D Atomic::AddImpl<D, I, typename std::enable_if<(((IsIntegral<I>::value && IsIntegral<T>::value) && (sizeof (I) <= sizeof (D))) && (IsSigned<I>::value == IsSigned<T>::value)), void>::type>::add_and_fetch(volatile D*, I, atomic_memory_order) [with D = long unsigned int; I = long unsigned int]' at /home/fyang/openjdk-jdk/src/hotspot/share/runtime/atomic.hpp:686:50,
          inlined from 'static D Atomic::add(volatile D*, I, atomic_memory_order) [with D = long unsigned int; I = long unsigned int]' at /home/fyang/openjdk-jdk/src/hotspot/share/runtime/atomic.hpp:667:38,
          inlined from 'size_t ZPageAllocator::uncommit(uint64_t*)' at /home/fyang/openjdk-jdk/src/hotspot/share/gc/z/zPageAllocator.cpp:789:16:
      /home/fyang/openjdk-jdk/src/hotspot/os_cpu/linux_riscv/atomic_linux_riscv.hpp:40:31: error: 'long unsigned int __atomic_add_fetch_8(volatile void*, long unsigned int, int)' writing 8 bytes into a region of size 0 overflows the destination [-Werror=stringop-overflow=]
         40 | D res = __atomic_add_fetch(dest, add_value, __ATOMIC_RELEASE);
            | ~~~~~~~~~~~~~~~~~~^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
      cc1plus: all warnings being treated as errors

      * All command lines available in /home/fyang/openjdk-jdk/build/linux-riscv64-server-release/make-support/failure-logs.
      === End of repeated output ===

      No indication of failed target found.
      HELP: Try searching the build log for '] Error'.
      HELP: Run 'make doctor' to diagnose build problems.

      make[1]: *** [/home/fyang/openjdk-jdk/make/Init.gmk:320: main] Error 2
      make: *** [/home/fyang/openjdk-jdk/make/Init.gmk:186: images] Error 2

            fyang Fei Yang
            fyang Fei Yang
            Votes:
            0 Vote for this issue
            Watchers:
            6 Start watching this issue

              Created:
              Updated: