RFR(S): 8252407: Build failure with gcc-8+ and asan

David Holmes david.holmes at oracle.com
Tue Sep 1 08:57:01 UTC 2020


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".

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. :(

Have you tested this by building on other platforms? I'm not sure if all 
compilers will ignore these gcc specific pragmas.

Thanks,
David

> [TESTS]
> Jtreg: hotspot::hotspot_all_no_apps, jdk::jdk_core and langtools::tier1.
> No new failure found.
> 
> http://cr.openjdk.java.net/~qfeng/ericliu/jdk/stringop_trunc/webrev.00/
> https://bugs.openjdk.java.net/browse/JDK-8252407
> 
> Thanks,
> Eric


More information about the serviceability-dev mailing list