[jdk19] RFR: 8288759: GCC 12 fails to compile signature.cpp due to -Wstringop-overread [v2]
Kim Barrett
kbarrett at openjdk.org
Tue Jul 5 01:09:28 UTC 2022
On Mon, 4 Jul 2022 12:12:40 GMT, Aleksey Shipilev <shade at openjdk.org> wrote:
>> Trying to compile with GCC 12.1.1 (current Fedora Rawhide) yields this failure:
>>
>>
>> In file included from /home/test/shipilev-jdk/src/hotspot/share/utilities/globalDefinitions_gcc.hpp:35,
>> from /home/test/shipilev-jdk/src/hotspot/share/utilities/globalDefinitions.hpp:35,
>> from /home/test/shipilev-jdk/src/hotspot/share/memory/allocation.hpp:29,
>> from /home/test/shipilev-jdk/src/hotspot/share/classfile/classLoaderData.hpp:28,
>> from /home/test/shipilev-jdk/src/hotspot/share/precompiled/precompiled.hpp:34:
>> In function 'const void* memchr(const void*, int, size_t)',
>> inlined from 'int SignatureStream::scan_type(BasicType)' at /home/test/shipilev-jdk/src/hotspot/share/runtime/signature.cpp:343:32,
>> inlined from 'void SignatureStream::next()' at /home/test/shipilev-jdk/src/hotspot/share/runtime/signature.cpp:373:19,
>> inlined from 'void SignatureIterator::do_parameters_on(T*) [with T = Fingerprinter]' at /home/test/shipilev-jdk/src/hotspot/share/runtime/signature.hpp:635:41,
>> inlined from 'void SignatureIterator::do_parameters_on(T*) [with T = Fingerprinter]' at /home/test/shipilev-jdk/src/hotspot/share/runtime/signature.hpp:629:6,
>> inlined from 'void Fingerprinter::compute_fingerprint_and_return_type(bool)' at /home/test/shipilev-jdk/src/hotspot/share/runtime/signature.cpp:169:19:
>
> Aleksey Shipilev has updated the pull request with a new target base due to a merge or a rebase. The incremental webrev excludes the unrelated changes brought in by the merge/rebase. The pull request contains three additional commits since the last revision:
>
> - Better fix the actual warning
> - Merge branch 'master' into JDK-8288759-gcc12-string-overread
> - Fix
The proposed fix seems plausible, and addresses the warning. I was a little worried that someone might come along later and try to change it to just
assert(end < limit, "invalid type");
but presumably that will get the warning again during testing.
I tried to think of a less contrived way to write this while still addressing the warning. I haven't come up with anything better, assuming returning limit is okay.
But I'm entirely unfamiliar with the signature code, so don't know if returning limit is okay. So don't count me as a reviewer for this change (and I won't hit the Approve button).
-------------
PR: https://git.openjdk.org/jdk19/pull/49
More information about the hotspot-dev
mailing list