[resend] 8236856: AArch64: Spurious GCC warnings

Andrew Haley aph at redhat.com
Thu Jan 9 16:09:52 UTC 2020


With some versions of GCC we get this at compile time, which causes build failures
when warnings-as-errors is enabled. It's a false positive, and should be fixed in
GCC, but we need to shut it up.

Compiling macroAssembler_aarch64.cpp (for libjvm.so)
In file included from /home/aph/jdk-jdk/src/hotspot/share/runtime/atomic.hpp:632:0,
                 from /home/aph/jdk-jdk/src/hotspot/share/oops/oop.hpp:33,
                 from /home/aph/jdk-jdk/src/hotspot/share/runtime/handles.hpp:29,
                 from /home/aph/jdk-jdk/src/hotspot/share/code/oopRecorder.hpp:28,
                 from /home/aph/jdk-jdk/src/hotspot/share/asm/codeBuffer.hpp:28,
                 from /home/aph/jdk-jdk/src/hotspot/share/asm/assembler.hpp:28,
                 from /home/aph/jdk-jdk/src/hotspot/cpu/aarch64/macroAssembler_aarch64.cpp:30:
/home/aph/jdk-jdk/src/hotspot/os_cpu/linux_aarch64/atomic_linux_aarch64.hpp: In instantiation of 'T Atomic::PlatformCmpxchg<byte_size>::operator()(volatile T*, T, T, atomic_memory_order) const [with T = signed char; long unsigned int byte_size = 1ul]':
/home/aph/jdk-jdk/src/hotspot/share/runtime/atomic.hpp:783:46: required from 'T Atomic::CmpxchgImpl<T, T, T, typename EnableIf<(IsIntegral<T>::value || IsRegisteredEnum<T>::value)>::type>::operator()(volatile T*, T, T, atomic_memory_order) const [with T = signed char; typename EnableIf<(IsIntegral<T>::value || IsRegisteredEnum<T>::value)>::type = void]'
/home/aph/jdk-jdk/src/hotspot/share/runtime/atomic.hpp:756:75: required from 'static D Atomic::cmpxchg(volatile D*, U, T, atomic_memory_order) [with D = signed char; U = signed char; T = signed char]'
/home/aph/jdk-jdk/src/hotspot/share/gc/shenandoah/shenandoahSharedVariables.hpp:77:113: required from here
/home/aph/jdk-jdk/src/hotspot/os_cpu/linux_aarch64/atomic_linux_aarch64.hpp:60:10: warning: parameter 'dest' set but not used [-Wunused-but-set-parameter]

Fixed thusly. OK?

-- 
Andrew Haley  (he/him)
Java Platform Lead Engineer
Red Hat UK Ltd. <https://www.redhat.com>
https://keybase.io/andrewhaley
EAC8 43EB D3EF DB98 CC77 2FAD A5CD 6035 332F A671

-------------- next part --------------
# HG changeset patch
# User aph
# Date 1578582061 18000
#      Thu Jan 09 10:01:01 2020 -0500
# Node ID a6c0679606c37ad3c7c21537bd338f4d272aa1e3
# Parent  6d23020e3da0ed7b276e10f60e0c8d178d7c049f
8236856: AArch64: Spurious GCC warnings
Reviewed-by: adinn

diff -r 6d23020e3da0 -r a6c0679606c3 src/hotspot/os_cpu/linux_aarch64/atomic_linux_aarch64.hpp
--- a/src/hotspot/os_cpu/linux_aarch64/atomic_linux_aarch64.hpp	Thu Jan 09 09:30:49 2020 -0500
+++ b/src/hotspot/os_cpu/linux_aarch64/atomic_linux_aarch64.hpp	Thu Jan 09 10:01:01 2020 -0500
@@ -55,9 +55,10 @@
   return res;
 }
 
+// __attribute__((unused)) on dest is to get rid of spurious GCC warnings.
 template<size_t byte_size>
 template<typename T>
-inline T Atomic::PlatformCmpxchg<byte_size>::operator()(T volatile* dest,
+inline T Atomic::PlatformCmpxchg<byte_size>::operator()(T volatile* dest __attribute__((unused)),
                                                         T compare_value,
                                                         T exchange_value,
                                                         atomic_memory_order order) const {


More information about the hotspot-dev mailing list