JDK-8360306 : RISC-V: Cross build fails due to GCC13 warning stringop-overflow after JDK-8352251
  • Type: Bug
  • Component: hotspot
  • Sub-Component: runtime
  • Priority: P4
  • Status: New
  • Resolution: Unresolved
  • OS: linux
  • CPU: riscv
  • Submitted: 2025-06-24
  • Updated: 2025-06-24
Related Reports
Causes :  
Description
Cross build with GCC 13.3.0 failed in our test environment:

Configuration:
====================================================
A new configuration has been successfully created in
/sysroot/riscv64/tmp/build-riscv64
using configure arguments '--with-debug-level=fastdebug --with-version-opt=git-9c3eaa49f7f --openjdk-target=riscv64-linux-gnu --with-sysroot=/sysroot/riscv64 --with-freetype=bundled --disable-javac-server --with-jmh=/tmp/jdk-src/build/jmh/jars'.

Configuration summary:
* Name:           /sysroot/riscv64/tmp/build-riscv64
* Debug level:    fastdebug
* HS debug level: fastdebug
* JVM variants:   server
* JVM features:   server: 'cds compiler1 compiler2 epsilongc g1gc jfr jni-check jvmci jvmti management parallelgc serialgc services shenandoahgc vm-structs zgc' 
* OpenJDK target: OS: linux, CPU architecture: riscv, address length: 64
* Version string: 26-internal-git-9c3eaa49f7f (26-internal)
* Source date:    1750701119 (2025-06-23T17:51:59Z)

Tools summary:
* Boot JDK:       openjdk version "24" 2025-03-18 OpenJDK Runtime Environment (build 24+36-3646) OpenJDK 64-Bit Server VM (build 24+36-3646, mixed mode, sharing) (at /usr/lib/jvm/jdk-24)
* Toolchain:      gcc (GNU Compiler Collection)
* Sysroot:        /sysroot/riscv64
* C Compiler:     Version 13.3.0 (at /usr/bin/riscv64-linux-gnu-gcc)
* C++ Compiler:   Version 13.3.0 (at /usr/bin/riscv64-linux-gnu-g++)

Build performance summary:
* Build jobs:     32
* Memory limit:   128471 MB


Error log:
=== Output from failing command(s) repeated here ===
* For target hotspot_variant-server_libjvm_objs_safepointMechanism.o:
In file included from /tmp/jdk-src/src/hotspot/share/runtime/atomic.hpp:862,
                 from /tmp/jdk-src/src/hotspot/share/oops/oop.hpp:35,
                 from /tmp/jdk-src/src/hotspot/share/oops/weakHandle.hpp:28,
                 from /tmp/jdk-src/src/hotspot/share/classfile/classLoaderData.hpp:30,
                 from /tmp/jdk-src/src/hotspot/share/precompiled/precompiled.hpp:32:
In member function ‘T Atomic::PlatformOrderedLoad<byte_size, X_ACQUIRE>::operator()(const volatile T*) const [with T = FilterQueue<HandshakeOperation*>::Node*; long unsigned int byte_size = 8]’,
    inlined from ‘T Atomic::LoadImpl<T, PlatformOp, typename std::enable_if<(std::is_integral<_Tp>::value || std::is_pointer<_Tp>::value), void>::type>::operator()(const volatile T*) const [with T = FilterQueue<HandshakeOperation*>::Node*; PlatformOp = <8, X_ACQUIRE>]’ at /tmp/jdk-src/src/hotspot/share/runtime/atomic.hpp:516:24,
    inlined from ‘static T Atomic::load_acquire(const volatile T*) [with T = FilterQueue<HandshakeOperation*>::Node*]’ at /tmp/jdk-src/src/hotspot/share/runtime/atomic.hpp:887:67,
    inlined from ‘FilterQueue<E>::Node* FilterQueue<E>::load_first() [with E = HandshakeOperation*]’ at /tmp/jdk-src/src/hotspot/share/utilities/filterQueue.hpp:47:32,
    inlined from ‘bool FilterQueue<E>::is_empty() [with E = HandshakeOperation*]’ at /tmp/jdk-src/src/hotspot/share/utilities/filterQueue.hpp:56:22,
    inlined from ‘bool HandshakeState::has_operation()’ at /tmp/jdk-src/src/hotspot/share/runtime/handshake.hpp:128:49,
    inlined from ‘static bool SafepointMechanism::has_pending_safepoint(JavaThread*)’ at /tmp/jdk-src/src/hotspot/share/runtime/safepointMechanism.inline.hpp:63:67,
    inlined from ‘static void SafepointMechanism::update_poll_values(JavaThread*)’ at /tmp/jdk-src/src/hotspot/share/runtime/safepointMechanism.cpp:100:39:
/tmp/jdk-src/src/hotspot/os_cpu/linux_riscv/atomic_linux_riscv.hpp:210:66: error: ‘long unsigned int __atomic_load_8(const volatile void*, int)’ writing 8 bytes into a region of size 0 overflows the destination [-Werror=stringop-overflow=]
  210 |   T operator()(const volatile T* p) const { T data; __atomic_load(const_cast<T*>(p), &data, __ATOMIC_ACQUIRE); return data; }
   ... (rest of output omitted)

* All command lines available in /sysroot/riscv64/tmp/build-riscv64/make-support/failure-logs.
=== End of repeated output ===