diff options
author | ienkovich <ienkovich@138bc75d-0d04-0410-961f-82ee72b054a4> | 2016-05-10 15:56:27 +0000 |
---|---|---|
committer | ienkovich <ienkovich@138bc75d-0d04-0410-961f-82ee72b054a4> | 2016-05-10 15:56:27 +0000 |
commit | e66d763abf14100c6a2ffdfc7ddd6eba8faf0bc5 (patch) | |
tree | a6f710ff66873b64cfdb7f8b6456b6d11a8d699a | |
parent | 2f45dbbd2c3f01a1dcdee4c265dc394561f42606 (diff) | |
download | gcc-e66d763abf14100c6a2ffdfc7ddd6eba8faf0bc5.tar.gz |
gcc/
PR tree-optimization/70786
* tree-chkp.c (chkp_find_bounds_1): Support WITH_SIZE_EXPR.
* gcc/calls.c (initialize_argument_information): Bind bounds
with corresponding args passed by reference.
gcc/testsuite/
PR tree-optimization/70786
* gcc.target/i386/pr70876.c: New test.
git-svn-id: svn+ssh://gcc.gnu.org/svn/gcc/trunk@236086 138bc75d-0d04-0410-961f-82ee72b054a4
-rw-r--r-- | gcc/ChangeLog | 7 | ||||
-rw-r--r-- | gcc/calls.c | 10 | ||||
-rw-r--r-- | gcc/testsuite/ChangeLog | 5 | ||||
-rw-r--r-- | gcc/testsuite/gcc.target/i386/pr70876.c | 13 | ||||
-rw-r--r-- | gcc/tree-chkp.c | 1 |
5 files changed, 36 insertions, 0 deletions
diff --git a/gcc/ChangeLog b/gcc/ChangeLog index dfbb1c3e073..e43a062ce9d 100644 --- a/gcc/ChangeLog +++ b/gcc/ChangeLog @@ -1,3 +1,10 @@ +2016-05-10 Ilya Enkovich <ilya.enkovich@intel.com> + + PR tree-optimization/70786 + * tree-chkp.c (chkp_find_bounds_1): Support WITH_SIZE_EXPR. + * gcc/calls.c (initialize_argument_information): Bind bounds + with corresponding args passed by reference. + 2016-05-10 Jakub Jelinek <jakub@redhat.com> PR target/70927 diff --git a/gcc/calls.c b/gcc/calls.c index 6415e08b28d..6cc1fc721e4 100644 --- a/gcc/calls.c +++ b/gcc/calls.c @@ -1188,6 +1188,7 @@ initialize_argument_information (int num_actuals ATTRIBUTE_UNUSED, j--; } } + argpos = 0; FOR_EACH_CALL_EXPR_ARG (arg, iter, exp) { tree argtype = TREE_TYPE (arg); @@ -1206,6 +1207,14 @@ initialize_argument_information (int num_actuals ATTRIBUTE_UNUSED, chkp_find_bound_slots (argtype, slots); } } + else if (CALL_WITH_BOUNDS_P (exp) + && pass_by_reference (NULL, TYPE_MODE (argtype), argtype, + argpos < n_named_args)) + { + if (slots) + BITMAP_FREE (slots); + ptr_arg = j; + } else if (POINTER_BOUNDS_TYPE_P (argtype)) { /* We expect bounds in instrumented calls only. @@ -1249,6 +1258,7 @@ initialize_argument_information (int num_actuals ATTRIBUTE_UNUSED, else args[j].tree_value = arg; j--; + argpos++; } if (slots) diff --git a/gcc/testsuite/ChangeLog b/gcc/testsuite/ChangeLog index deec34e8bbd..7cf507f51f6 100644 --- a/gcc/testsuite/ChangeLog +++ b/gcc/testsuite/ChangeLog @@ -1,3 +1,8 @@ +2016-05-10 Ilya Enkovich <ilya.enkovich@intel.com> + + PR tree-optimization/70786 + * gcc.target/i386/pr70876.c: New test. + 2016-05-10 Jakub Jelinek <jakub@redhat.com> PR target/70927 diff --git a/gcc/testsuite/gcc.target/i386/pr70876.c b/gcc/testsuite/gcc.target/i386/pr70876.c new file mode 100644 index 00000000000..c9bab690b33 --- /dev/null +++ b/gcc/testsuite/gcc.target/i386/pr70876.c @@ -0,0 +1,13 @@ +/* { dg-do compile { target { ! x32 } } } */ +/* { dg-options "-fcheck-pointer-bounds -mmpx -Wno-implicit-function-declaration" } */ + +void f (char *s1, char *s2) +{ + int z = 5; + + struct { char a[z]; } x; + + s1[0] = s2[0]; + + foo (x, x); +} diff --git a/gcc/tree-chkp.c b/gcc/tree-chkp.c index 3fba12c2ae4..8c7d214e0e3 100644 --- a/gcc/tree-chkp.c +++ b/gcc/tree-chkp.c @@ -3646,6 +3646,7 @@ chkp_find_bounds_1 (tree ptr, tree ptr_src, gimple_stmt_iterator *iter) break; case ADDR_EXPR: + case WITH_SIZE_EXPR: bounds = chkp_make_addressed_object_bounds (TREE_OPERAND (ptr_src, 0), iter); break; |