On Wed, 6 Sep 2023 14:29:56 GMT, Antonios Printezis <to...@openjdk.org> wrote:

> The build failure happens when building on RISC-V with GCC 12.3. Is there a 
> better way to address this than disabling the stringop-overflow warnings for 
> the two files in question?

I should have included the full error messages (my bad):


In file included from 
/home/tony/dev/ws/git/jdk-devel/src/hotspot/share/runtime/atomic.hpp:814,
                 from 
/home/tony/dev/ws/git/jdk-devel/src/hotspot/share/oops/oop.hpp:34,
                 from 
/home/tony/dev/ws/git/jdk-devel/src/hotspot/share/oops/weakHandle.hpp:28,
                 from 
/home/tony/dev/ws/git/jdk-devel/src/hotspot/share/classfile/classLoaderData.hpp:30,
                 from 
/home/tony/dev/ws/git/jdk-devel/src/hotspot/share/precompiled/precompiled.hpp:34:
In member function 'D Atomic::PlatformAdd<byte_size>::add_then_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<(((std::is_integral<From>::value && 
std::is_integral<_Tp>::value) && (sizeof (I) <= sizeof (D))) && 
(std::is_signed<I>::value == std::is_signed<_Tp>::value)), 
void>::type>::add_then_fetch(volatile D*, I, atomic_memory_order) [with D = 
long unsigned int; I = long unsigned int]' at 
/home/tony/dev/ws/git/jdk-devel/src/hotspot/share/runtime/atomic.hpp:888:51,
    inlined from 'static D Atomic::add(volatile D*, I, atomic_memory_order) 
[with D = long unsigned int; I = long unsigned int]' at 
/home/tony/dev/ws/git/jdk-devel/src/hotspot/share/runtime/atomic.hpp:869:39,
    inlined from 'size_t XPageAllocator::uncommit(uint64_t*)' at 
/home/tony/dev/ws/git/jdk-devel/src/hotspot/share/gc/x/xPageAllocator.cpp:789:16:
/home/tony/dev/ws/git/jdk-devel/src/hotspot/os_cpu/linux_riscv/atomic_linux_riscv.hpp:44: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=]
   44 |     D res = __atomic_add_fetch(dest, add_value, __ATOMIC_RELAXED);
      |             ~~~~~~~~~~~~~~~~~~^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
In file included from 
/home/tony/dev/ws/git/jdk-devel/src/hotspot/share/runtime/atomic.hpp:814,
                 from 
/home/tony/dev/ws/git/jdk-devel/src/hotspot/share/oops/oop.hpp:34,
                 from 
/home/tony/dev/ws/git/jdk-devel/src/hotspot/share/oops/weakHandle.hpp:28,
                 from 
/home/tony/dev/ws/git/jdk-devel/src/hotspot/share/classfile/classLoaderData.hpp:30,
                 from 
/home/tony/dev/ws/git/jdk-devel/src/hotspot/share/precompiled/precompiled.hpp:34:
In member function 'D Atomic::PlatformAdd<byte_size>::add_then_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<(((std::is_integral<From>::value && 
std::is_integral<_Tp>::value) && (sizeof (I) <= sizeof (D))) && 
(std::is_signed<I>::value == std::is_signed<_Tp>::value)), 
void>::type>::add_then_fetch(volatile D*, I, atomic_memory_order) [with D = 
long unsigned int; I = long unsigned int]' at 
/home/tony/dev/ws/git/jdk-devel/src/hotspot/share/runtime/atomic.hpp:888:51,
    inlined from 'static D Atomic::add(volatile D*, I, atomic_memory_order) 
[with D = long unsigned int; I = long unsigned int]' at 
/home/tony/dev/ws/git/jdk-devel/src/hotspot/share/runtime/atomic.hpp:869:39,
    inlined from 'size_t ZPageAllocator::uncommit(uint64_t*)' at 
/home/tony/dev/ws/git/jdk-devel/src/hotspot/share/gc/z/zPageAllocator.cpp:887:16:
/home/tony/dev/ws/git/jdk-devel/src/hotspot/os_cpu/linux_riscv/atomic_linux_riscv.hpp:44: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=]
   44 |     D res = __atomic_add_fetch(dest, add_value, __ATOMIC_RELAXED);
      |             ~~~~~~~~~~~~~~~~~~^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
cc1plus: all warnings being treated as errors


Looks the same as [JDK-8299580](https://bugs.openjdk.org/browse/JDK-8299580) 
that @RealFYang had reported?

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

PR Comment: https://git.openjdk.org/jdk/pull/15593#issuecomment-1710788551

Reply via email to