RFR: 8252407: Build failure with gcc-8+ and asan.

Magnus Ihse Bursie ihse at openjdk.java.net
Mon Oct 12 12:35:16 UTC 2020


On Mon, 12 Oct 2020 11:36:17 GMT, eric.1iu <github.com+10482586+erik1iu at openjdk.org> wrote:

> Summary: Fix stringop-truncation warnings casused by gcc.
> 
> 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.
> 
> The reason is that -fsanitize=address might simply incompatible with
> -Wstringop-truncation. This patch disables stringop-truncation warning
> when asan enabled, also disables the defining of _FORTIFY_SOURCE in
> fastdebug builds for some potential risks.

Looks good to me.

It's slightly unsettling that we enable fortify silently under very special circumstances, but while the circumstances
change with the bug, the behavior as such do not, so I don't think this is the place to make it more visible and/or
controllable.

-------------

Marked as reviewed by ihse (Reviewer).

PR: https://git.openjdk.java.net/jdk/pull/607



More information about the build-dev mailing list