aboutsummaryrefslogtreecommitdiff
path: root/gcc
diff options
context:
space:
mode:
Diffstat (limited to 'gcc')
-rw-r--r--gcc/ChangeLog3
-rw-r--r--gcc/testsuite/ChangeLog2
-rw-r--r--gcc/testsuite/gcc.target/i386/mpx/pointer-diff-1.c8
-rw-r--r--gcc/tree-chkp.c1
4 files changed, 14 insertions, 0 deletions
diff --git a/gcc/ChangeLog b/gcc/ChangeLog
index f1ce291..40ef3d0 100644
--- a/gcc/ChangeLog
+++ b/gcc/ChangeLog
@@ -1,5 +1,8 @@
2017-12-02 Jakub Jelinek <jakub@redhat.com>
+ * tree-chkp.c (chkp_compute_bounds_for_assignment): Handle
+ POINTER_DIFF_EXPR.
+
PR c++/81212
* tree-cfg.c (pass_warn_function_return::execute): Handle
__builtin_ubsan_handle_missing_return like __builtin_unreachable
diff --git a/gcc/testsuite/ChangeLog b/gcc/testsuite/ChangeLog
index eedf1a8..c66f314 100644
--- a/gcc/testsuite/ChangeLog
+++ b/gcc/testsuite/ChangeLog
@@ -1,5 +1,7 @@
2017-12-02 Jakub Jelinek <jakub@redhat.com>
+ * gcc.target/i386/mpx/pointer-diff-1.c: New test.
+
PR c++/81212
* g++.dg/ubsan/pr81212.C: New test.
* g++.dg/ubsan/return-1.C: Add -Wno-return-type to dg-options.
diff --git a/gcc/testsuite/gcc.target/i386/mpx/pointer-diff-1.c b/gcc/testsuite/gcc.target/i386/mpx/pointer-diff-1.c
new file mode 100644
index 0000000..6579919
--- /dev/null
+++ b/gcc/testsuite/gcc.target/i386/mpx/pointer-diff-1.c
@@ -0,0 +1,8 @@
+/* { dg-do compile } */
+/* { dg-options "-O2 -mmpx -fcheck-pointer-bounds" } */
+
+char *
+foo (char *p, char *q)
+{
+ return (char *) (p - q); /* { dg-bogus "pointer bounds were lost due to unexpected expression" } */
+}
diff --git a/gcc/tree-chkp.c b/gcc/tree-chkp.c
index 6d24355..8296786 100644
--- a/gcc/tree-chkp.c
+++ b/gcc/tree-chkp.c
@@ -2762,6 +2762,7 @@ chkp_compute_bounds_for_assignment (tree node, gimple *assign)
case FLOAT_EXPR:
case REALPART_EXPR:
case IMAGPART_EXPR:
+ case POINTER_DIFF_EXPR:
/* No valid bounds may be produced by these exprs. */
bounds = chkp_get_invalid_op_bounds ();
break;