* tree-chkp.c (chkp_compute_bounds_for_assignment): Handle
POINTER_DIFF_EXPR.
* gcc.target/i386/mpx/pointer-diff-1.c: New test.
From-SVN: r255355
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
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.
--- /dev/null
+/* { 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" } */
+}
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;