diff options
author | Jakub Jelinek <jakub@redhat.com> | 2017-12-02 08:58:05 +0100 |
---|---|---|
committer | Jakub Jelinek <jakub@gcc.gnu.org> | 2017-12-02 08:58:05 +0100 |
commit | edb48cdb9f8dcc52b20f12785a1d570084597842 (patch) | |
tree | c66593139e7d3abc4642c2568ffc48e400187d30 /gcc | |
parent | 38651b523d2df78a62489911e1c0036847c116bd (diff) | |
download | gcc-edb48cdb9f8dcc52b20f12785a1d570084597842.zip gcc-edb48cdb9f8dcc52b20f12785a1d570084597842.tar.gz gcc-edb48cdb9f8dcc52b20f12785a1d570084597842.tar.bz2 |
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
Diffstat (limited to 'gcc')
-rw-r--r-- | gcc/ChangeLog | 3 | ||||
-rw-r--r-- | gcc/testsuite/ChangeLog | 2 | ||||
-rw-r--r-- | gcc/testsuite/gcc.target/i386/mpx/pointer-diff-1.c | 8 | ||||
-rw-r--r-- | gcc/tree-chkp.c | 1 |
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; |