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

Kim Barrett kim.barrett at oracle.com
Mon Sep 7 01:49:48 UTC 2020


> On Sep 6, 2020, at 7:35 AM, Kim Barrett <kim.barrett at oracle.com> wrote:
> src/hotspot/share/compiler/compileBroker.hpp
> 64 PRAGMA_DIAG_PUSH
> 65 PRAGMA_STRINGOP_TRUNCATION_IGNORED
> 66       // This code can incorrectly cause a "stringop-truncation" warning with gcc
> 67       strncpy(_current_method, method, (size_t)cmname_buffer_length-1);
> 68 PRAGMA_DIAG_POP
> 69       _current_method[cmname_buffer_length-1] = '\0';
> 
> I think I'd prefer the PRAGMA_DIAG_POP moved one line further down, so
> that the push/pop surrounds the entire idiomactic usage that is
> supposed to prevent the warning.  This seems to be a gcc8 bug.
> 
> gcc10 doesn't warn about this (and shouldn't).  It would be
> interesting to know if it too warns with --enable-asan.

I keep forgetting.  This is the one where we think the cast on line 67 might be
confusing gcc8, and if it were eliminated we might not need the PRAGMA dance
here after all.




More information about the hotspot-dev mailing list