Do not allow -mabi=ms and -fsanitize={,kernel-}address (PR sanitizer/87930).
authorMartin Liska <mliska@suse.cz>
Tue, 13 Nov 2018 15:03:58 +0000 (16:03 +0100)
committerMartin Liska <marxin@gcc.gnu.org>
Tue, 13 Nov 2018 15:03:58 +0000 (15:03 +0000)
2018-11-13  Martin Liska  <mliska@suse.cz>

PR sanitizer/87930
* config/i386/i386.c (ix86_option_override_internal): Error
about usage -mabi=ms and -fsanitize={,kernel-}address.
2018-11-13  Martin Liska  <mliska@suse.cz>

PR sanitizer/87930
* gcc.target/i386/pr87930.c: New test.

From-SVN: r266073

gcc/ChangeLog
gcc/config/i386/i386.c
gcc/testsuite/ChangeLog
gcc/testsuite/gcc.target/i386/pr87930.c [new file with mode: 0644]

index 9201af4945f04fde8e754116ba57b500f34a466b..fc809d395c60a1bd33991ddd73f6d02764d17219 100644 (file)
@@ -1,3 +1,9 @@
+2018-11-13  Martin Liska  <mliska@suse.cz>
+
+       PR sanitizer/87930
+       * config/i386/i386.c (ix86_option_override_internal): Error
+       about usage -mabi=ms and -fsanitize={,kernel-}address.
+
 2018-11-13  Andre Vieira  <andre.simoesdiasvieira@arm.com>
 
        * config/aarch64/aarch64.c
index 711bec0cc9d7ce98abbf8a40517234f933f5edd9..b3e0807b894a52a1c8dc641b3da0f5e8801c63c0 100644 (file)
@@ -3546,6 +3546,11 @@ ix86_option_override_internal (bool main_args_p,
     error ("-mabi=ms not supported with X32 ABI");
   gcc_assert (opts->x_ix86_abi == SYSV_ABI || opts->x_ix86_abi == MS_ABI);
 
+  if ((opts->x_flag_sanitize & SANITIZE_USER_ADDRESS) && opts->x_ix86_abi == MS_ABI)
+    error ("%<-mabi=ms%> not supported with %<-fsanitize=address%>");
+  if ((opts->x_flag_sanitize & SANITIZE_KERNEL_ADDRESS) && opts->x_ix86_abi == MS_ABI)
+    error ("%<-mabi=ms%> not supported with %<-fsanitize=kernel-address%>");
+
   /* For targets using ms ABI enable ms-extensions, if not
      explicit turned off.  For non-ms ABI we turn off this
      option.  */
index bc4530845fc0f77afdcdf5c5eb20b3607b7f92ad..70d9e76834d8448e23d20c6ff46a6ed316d12277 100644 (file)
@@ -1,3 +1,8 @@
+2018-11-13  Martin Liska  <mliska@suse.cz>
+
+       PR sanitizer/87930
+       * gcc.target/i386/pr87930.c: New test.
+
 2018-11-13  Richard Biener  <rguenther@suse.de>
 
        PR tree-optimization/87962
diff --git a/gcc/testsuite/gcc.target/i386/pr87930.c b/gcc/testsuite/gcc.target/i386/pr87930.c
new file mode 100644 (file)
index 0000000..e9cf29c
--- /dev/null
@@ -0,0 +1,6 @@
+/* { dg-do compile { target lp64 } } */
+/* { dg-options "-fsanitize=address -mabi=ms" } */
+
+int i;
+
+/* { dg-error ".-mabi=ms. not supported with .-fsanitize=address." "" { target *-*-* } 0 } */