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 c2f2a0b..3ea7a01 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 426c8ad..f324515 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 543b8a3..f51d2cb 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.  */