RFR(S): 8252407: Build failure with gcc-8+ and asan
Kim Barrett
kim.barrett at oracle.com
Tue Sep 1 09:19:55 UTC 2020
> On Sep 1, 2020, at 4:57 AM, David Holmes <david.holmes at oracle.com> wrote:
>
> Hi Eric,
>
> On 1/09/2020 6:15 pm, Eric Liu wrote:
>> Hi all,
>> Please review this simple change to fix some compile warnings.
>> The newer gcc (gcc-8 or higher) would warn for calls to bounded string
>> manipulation functions such as 'strncpy' that may either truncate the
>> copied string or leave the destination unchanged.
>> This patch fixed stringop-truncation warnings reported by gcc, some of
>> them only appear when compiled with "--enable-asan”.
Not a review, just responding to David’s comments.
> We already build with gcc 9.2 and don't see any issues with shared code compiling for hotspot - which of these require --enable-asan? It certainly looks like an unnecessary warning - the whole point of strncpy is to truncate at a safe length. :(
-Wstringop-truncation seems to be somewhat buggy, esp. older versions of it, generating many
false positives (as well as false negatives). But we’ve been reluctant to just turn it off, because it
has actually found real bugs in our code.
> Have you tested this by building on other platforms? I'm not sure if all compilers will ignore these gcc specific pragmas.
The pragma macros are defined appropriately for use in shared code.
More information about the serviceability-dev
mailing list