[12] RFR: 8214777: Avoid some GCC 8.X strncpy() errors in HotSpot

Simon Tooke stooke at redhat.com
Tue Dec 11 21:42:26 UTC 2018


On 2018-12-11 12:05 p.m., Kim Barrett wrote:
>> On Dec 11, 2018, at 11:14 AM, Kim Barrett <kim.barrett at oracle.com> wrote:
>>
>>> On Dec 10, 2018, at 1:57 PM, Simon Tooke <stooke at redhat.com> wrote:
>>>
>>> This small patch fixes some simple warnings in Hotspot code, found by
>>> GCC 8.1
>> What, exactly, is the warning?
>>
>> Whatever the warning is, having common false positives is really unpleasant, and should be reported.
>> Is there a gcc bug for this?  Is the warning sufficiently fine grained to be reasonable to disable?  Or
>> maybe disable until such time as the false positives get fixed?
> Answering my own question, probably -Wstringop-truncation.
>
> And the documentation seems to suggest code exactly like the original
> (e.g. storing a NUL at the end of the destination) ought to suppress
> the warning. That's also suggested in a comment here:
>
> https://gcc.gnu.org/bugzilla/show_bug.cgi?id=85902
>
> This warning seems to have a bit of a bug tail, some of which have
> been fixed, but might not be fixed in the gcc version you are using.
> A couple of possibly relevant examples:
>
> https://gcc.gnu.org/bugzilla/show_bug.cgi?id=84468
> https://gcc.gnu.org/bugzilla/show_bug.cgi?id=84480
I've followed some of those GCC issues too, and it looks like that
warning wasn't ready for prime time.
>
> Maybe we should just globally suppress this warning for gcc8.x (where
> it is new), and revisit later.
>
I'm fine with this; there are two warnings that cause JDK source grief:

-Wstringop-truncation and -Wstringop-overflow.






More information about the hotspot-runtime-dev mailing list