Enable -fsanitize-address-use-after-scope only if -fsanitize=address is enabled
authorDmitry Vyukov <dvyukov@google.com>
Thu, 8 Dec 2016 14:32:24 +0000 (06:32 -0800)
committerDmitry Vyukov <dvyukov@gcc.gnu.org>
Thu, 8 Dec 2016 14:32:24 +0000 (06:32 -0800)
2016-12-08  Dmitry Vyukov  <dvyukov@google.com>

* 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

gcc/ChangeLog
gcc/doc/invoke.texi
gcc/opts.c

index 91a1ed3562d32dae56f5f7c8faeb4104e60bac14..37666662a104152e16f2c9cca7aa0bd188162689 100644 (file)
@@ -1,3 +1,11 @@
+2016-12-08  Dmitry Vyukov  <dvyukov@google.com>
+
+       * 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  <bin.cheng@arm.com>
 
        PR middle-end/78684
index 5622c0f107e191c6d70f17d5876443d7a6e109ab..02a34fb724dd15e489db38fe9fa47037d6a3bb8a 100644 (file)
@@ -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
index c61c3677a668cc68a7befc740290f7d444a560e5..890da03e6a12d4eaadae8b21b96998ccf9a8ad74 100644 (file)
@@ -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;