Commit edb48cdb by Jakub Jelinek Committed by Jakub Jelinek

tree-chkp.c (chkp_compute_bounds_for_assignment): Handle POINTER_DIFF_EXPR.

	* 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
parent 38651b52
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.
......
/* { 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" } */
}
......@@ -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;
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment