Do not enable -fcheck-pointer-bounds w/ -fsanitize=bounds
authorMartin Liska <mliska@suse.cz>
Mon, 13 Jun 2016 07:17:16 +0000 (09:17 +0200)
committerMartin Liska <marxin@gcc.gnu.org>
Mon, 13 Jun 2016 07:17:16 +0000 (07:17 +0000)
PR sanitizer/71458
* toplev.c (process_options): Do not enable -fcheck-pointer-bounds
w/ -fsanitize=bounds.
* gcc.target/i386/pr71458.c: New test.

From-SVN: r237353

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

index c2f2a0b88ea8c0087bca850dd4ae714788679dcf..3ea7a014f5a19f2b58871a2f049ee93fd5200a26 100644 (file)
@@ -1,3 +1,9 @@
+2016-06-13  Martin Liska  <mliska@suse.cz>
+
+       PR sanitizer/71458
+       * toplev.c (process_options): Do not enable -fcheck-pointer-bounds
+       w/ -fsanitize=bounds.
+
 2016-06-12  Uros Bizjak  <ubizjak@gmail.com>
 
        * config/i386/i386.c (ix86_init_builtins): Calculate
index 426c8ad1865a7a28f3f698184707f88ebaecf675..f3245154d776311bcabd6700125c2f6ade7f761d 100644 (file)
@@ -1,3 +1,7 @@
+2016-06-13  Martin Liska  <mliska@suse.cz>
+
+       * gcc.target/i386/pr71458.c: New test.
+
 2016-06-12  Uros Bizjak  <ubizjak@gmail.com>
 
        PR target/71241
diff --git a/gcc/testsuite/gcc.target/i386/pr71458.c b/gcc/testsuite/gcc.target/i386/pr71458.c
new file mode 100644 (file)
index 0000000..27e7764
--- /dev/null
@@ -0,0 +1,7 @@
+/* { dg-do compile { target { ! x32 } } } */
+/* { dg-options "-fcheck-pointer-bounds -mmpx -fsanitize=bounds" } */
+/* { dg-error "-fcheck-pointer-bounds is not supported with -fsanitize=bounds" "" { target *-*-* } 0 } */
+
+enum {} a[0];
+void fn1(int);
+void fn2() { fn1(a[-1]); }
index 543b8a3dc72a67c42e73673d814eeb9e4a157bb6..f51d2cb2b77eccf338154961745386e3343a3a9a 100644 (file)
@@ -1276,6 +1276,15 @@ process_options (void)
                    "Address Sanitizer");
          flag_check_pointer_bounds = 0;
        }
+
+      if (flag_sanitize & SANITIZE_BOUNDS)
+       {
+         error_at (UNKNOWN_LOCATION,
+                   "-fcheck-pointer-bounds is not supported with "
+                   "-fsanitize=bounds");
+         flag_check_pointer_bounds = 0;
+       }
+
     }
 
   /* One region RA really helps to decrease the code size.  */