[PATCH][jdk8u] hotspot: Fix build warning with gcc 7.x

Andrew Hughes gnu.andrew at redhat.com
Tue Jan 1 22:57:19 UTC 2019


On Thu, 20 Dec 2018 at 13:27, Siddhesh Poyarekar <siddhesh at gotplt.org> wrote:
>
> Hi,
>
> gcc 7 has improved diagnostics that warn on potential out of bounds
> errors.  This results in the following warning when building jdk8u with
> gcc 7:
>
> /home/ubuntu/openjdk/jdk8u/hotspot/src/share/vm/code/dependencies.cpp:
> In function ‘static void Dependencies::write_dependency_to(xmlStream*,
> Dependencies::DepType, GrowableArray<Dependencies::DepArgument>*, Klass*)’:
> /home/ubuntu/openjdk/jdk8u/hotspot/src/share/vm/code/dependencies.cpp:498:6:
> warning: ‘%d’ directive writing between 1 and 10 bytes into a region of
> size 9 [-Wformat-overflow=]
>   void Dependencies::write_dependency_to(xmlStream* xtty,
>        ^~~~~~~~~~~~
> /home/ubuntu/openjdk/jdk8u/hotspot/src/share/vm/code/dependencies.cpp:498:6:
> note: directive argument in the range [0, 2147483647]
> In file included from /usr/include/stdio.h:862:0,
>                   from
> /home/ubuntu/openjdk/jdk8u/hotspot/src/share/vm/prims/jni.h:39,
>                   from
> /home/ubuntu/openjdk/jdk8u/hotspot/src/share/vm/utilities/globalDefinitions_gcc.hpp:28,
>                   from
> /home/ubuntu/openjdk/jdk8u/hotspot/src/share/vm/utilities/globalDefinitions.hpp:33,
>                   from
> /home/ubuntu/openjdk/jdk8u/hotspot/src/share/vm/utilities/debug.hpp:28,
>                   from
> /home/ubuntu/openjdk/jdk8u/hotspot/src/share/vm/runtime/globals.hpp:28,
>                   from
> /home/ubuntu/openjdk/jdk8u/hotspot/src/share/vm/memory/allocation.hpp:28,
>                   from
> /home/ubuntu/openjdk/jdk8u/hotspot/src/share/vm/memory/iterator.hpp:28,
>                   from
> /home/ubuntu/openjdk/jdk8u/hotspot/src/share/vm/memory/genOopClosures.hpp:28,
>                   from
> /home/ubuntu/openjdk/jdk8u/hotspot/src/share/vm/oops/klass.hpp:28,
>                   from
> /home/ubuntu/openjdk/jdk8u/hotspot/src/share/vm/runtime/handles.hpp:28,
>                   from
> /home/ubuntu/openjdk/jdk8u/hotspot/src/share/vm/memory/universe.hpp:28,
>                   from
> /home/ubuntu/openjdk/jdk8u/hotspot/src/share/vm/code/oopRecorder.hpp:28,
>                   from
> /home/ubuntu/openjdk/jdk8u/hotspot/src/share/vm/asm/codeBuffer.hpp:28,
>                   from
> /home/ubuntu/openjdk/jdk8u/hotspot/src/share/vm/asm/assembler.hpp:28,
>                   from
> /home/ubuntu/openjdk/jdk8u/hotspot/src/share/vm/precompiled/precompiled.hpp:29:
> /usr/include/aarch64-linux-gnu/bits/stdio2.h:34:43: note:
> ‘__builtin___sprintf_chk’ output between 3 and 12 bytes into a
> destination of size 10
>         __bos (__s), __fmt, __va_arg_pack ());
>                                             ^
> The bounds will likely never be crossed in practice but it might be safe
> to trivially bump up th size of the array in question (xn) and thus
> silence the warning.  Attached patch does that.
>
> I have build tested this on aarch64 and x86 to verify that the warning
> is silenced.  A hotspot test run aarch64 shows no new test failures from
> this.
>
> Siddhesh

I believe this is:

https://bugs.openjdk.java.net/browse/JDK-8184309

which would need to be backported to 8u.
-- 
Andrew :)

Senior Free Java Software Engineer
Red Hat, Inc. (http://www.redhat.com)

Web Site: http://fuseyism.com
Twitter: https://twitter.com/gnu_andrew_java
PGP Key: ed25519/0xCFDA0F9B35964222 (hkp://keys.gnupg.net)
Fingerprint = 5132 579D D154 0ED2 3E04  C5A0 CFDA 0F9B 3596 4222


More information about the jdk8u-dev mailing list