From: Dmitry Vyukov Date: Thu, 8 Dec 2016 14:32:24 +0000 (-0800) Subject: Enable -fsanitize-address-use-after-scope only if -fsanitize=address is enabled X-Git-Tag: basepoints/gcc-8~2450 X-Git-Url: http://git.ipfire.org/?a=commitdiff_plain;h=04bfa1e4691afb9eb0edcd9e80ec1e542628c7d4;p=thirdparty%2Fgcc.git Enable -fsanitize-address-use-after-scope only if -fsanitize=address is enabled 2016-12-08 Dmitry Vyukov * opts.c (finish_options): Enable -fsanitize-address-use-after-scope only if -fsanitize=address is enabled (not -fsanitize=kernel-address). * doc/invoke.texi (-fsanitize=kernel-address): Don't say that it enables -fsanitize-address-use-after-scope. From-SVN: r243441 --- diff --git a/gcc/ChangeLog b/gcc/ChangeLog index 91a1ed3562d3..37666662a104 100644 --- a/gcc/ChangeLog +++ b/gcc/ChangeLog @@ -1,3 +1,11 @@ +2016-12-08 Dmitry Vyukov + + * opts.c (finish_options): Enable + -fsanitize-address-use-after-scope only if -fsanitize=address is enabled + (not -fsanitize=kernel-address). + * doc/invoke.texi (-fsanitize=kernel-address): + Don't say that it enables -fsanitize-address-use-after-scope. + 2016-12-08 Bin Cheng PR middle-end/78684 diff --git a/gcc/doc/invoke.texi b/gcc/doc/invoke.texi index 5622c0f107e1..02a34fb724dd 100644 --- a/gcc/doc/invoke.texi +++ b/gcc/doc/invoke.texi @@ -10640,7 +10640,6 @@ The option can't be combined with @option{-fsanitize=thread}. @item -fsanitize=kernel-address @opindex fsanitize=kernel-address Enable AddressSanitizer for Linux kernel. -The option enables @option{-fsanitize-address-use-after-scope}. See @uref{https://github.com/google/kasan/wiki} for more details. @item -fsanitize=thread diff --git a/gcc/opts.c b/gcc/opts.c index c61c3677a668..890da03e6a12 100644 --- a/gcc/opts.c +++ b/gcc/opts.c @@ -990,7 +990,7 @@ finish_options (struct gcc_options *opts, struct gcc_options *opts_set, /* Enable -fsanitize-address-use-after-scope if address sanitizer is enabled. */ - if (opts->x_flag_sanitize + if ((opts->x_flag_sanitize & SANITIZE_USER_ADDRESS) && !opts_set->x_flag_sanitize_address_use_after_scope) opts->x_flag_sanitize_address_use_after_scope = true;