diff options
author | Martin Liska <mliska@suse.cz> | 2017-03-20 11:06:00 +0100 |
---|---|---|
committer | Martin Liska <marxin@gcc.gnu.org> | 2017-03-20 10:06:00 +0000 |
commit | 243e28bfb984e4cd2f0008e5096d9e5d6941e622 (patch) | |
tree | dc6752f8d9cebc7d61e8a7709391fa345e70b635 /gcc | |
parent | 918112d378787a2227f61225098289a14b1ccd22 (diff) | |
download | gcc-243e28bfb984e4cd2f0008e5096d9e5d6941e622.zip gcc-243e28bfb984e4cd2f0008e5096d9e5d6941e622.tar.gz gcc-243e28bfb984e4cd2f0008e5096d9e5d6941e622.tar.bz2 |
MPX: fix PR middle-end/79753
2017-03-20 Martin Liska <mliska@suse.cz>
PR middle-end/79753
* tree-chkp.c (chkp_build_returned_bound): Do not build
returned bounds for a LHS that's not a BOUNDED_P type.
2017-03-20 Martin Liska <mliska@suse.cz>
PR middle-end/79753
* gcc.target/i386/mpx/pr79753.c: New test.
From-SVN: r246276
Diffstat (limited to 'gcc')
-rw-r--r-- | gcc/ChangeLog | 6 | ||||
-rw-r--r-- | gcc/testsuite/ChangeLog | 5 | ||||
-rw-r--r-- | gcc/testsuite/gcc.target/i386/mpx/pr79753.c | 14 | ||||
-rw-r--r-- | gcc/tree-chkp.c | 11 |
4 files changed, 31 insertions, 5 deletions
diff --git a/gcc/ChangeLog b/gcc/ChangeLog index 57adde8..5024c0f 100644 --- a/gcc/ChangeLog +++ b/gcc/ChangeLog @@ -1,5 +1,11 @@ 2017-03-20 Martin Liska <mliska@suse.cz> + PR middle-end/79753 + * tree-chkp.c (chkp_build_returned_bound): Do not build + returned bounds for a LHS that's not a BOUNDED_P type. + +2017-03-20 Martin Liska <mliska@suse.cz> + PR target/79769 PR target/79770 * tree-chkp.c (chkp_find_bounds_1): Handle REAL_CST, diff --git a/gcc/testsuite/ChangeLog b/gcc/testsuite/ChangeLog index 280e5e9..2a76758 100644 --- a/gcc/testsuite/ChangeLog +++ b/gcc/testsuite/ChangeLog @@ -1,5 +1,10 @@ 2017-03-20 Martin Liska <mliska@suse.cz> + PR middle-end/79753 + * gcc.target/i386/mpx/pr79753.c: New test. + +2017-03-20 Martin Liska <mliska@suse.cz> + PR target/79769 PR target/79770 * g++.dg/pr79769.C: New test. diff --git a/gcc/testsuite/gcc.target/i386/mpx/pr79753.c b/gcc/testsuite/gcc.target/i386/mpx/pr79753.c new file mode 100644 index 0000000..9b7bc52 --- /dev/null +++ b/gcc/testsuite/gcc.target/i386/mpx/pr79753.c @@ -0,0 +1,14 @@ +/* { dg-do compile } */ +/* { dg-options "-fcheck-pointer-bounds -mmpx -O2" } */ + +int +foo (void) +{ + return 0; +} + +void +bar (int **p) +{ + *p = (int *) (__UINTPTR_TYPE__) foo (); +} diff --git a/gcc/tree-chkp.c b/gcc/tree-chkp.c index c9c8c23..b1ff218 100644 --- a/gcc/tree-chkp.c +++ b/gcc/tree-chkp.c @@ -2218,6 +2218,7 @@ chkp_build_returned_bound (gcall *call) gimple *stmt; tree fndecl = gimple_call_fndecl (call); unsigned int retflags; + tree lhs = gimple_call_lhs (call); /* To avoid fixing alloca expands in targets we handle it separately. */ @@ -2227,9 +2228,8 @@ chkp_build_returned_bound (gcall *call) || DECL_FUNCTION_CODE (fndecl) == BUILT_IN_ALLOCA_WITH_ALIGN)) { tree size = gimple_call_arg (call, 0); - tree lb = gimple_call_lhs (call); gimple_stmt_iterator iter = gsi_for_stmt (call); - bounds = chkp_make_bounds (lb, size, &iter, true); + bounds = chkp_make_bounds (lhs, size, &iter, true); } /* We know bounds returned by set_bounds builtin call. */ else if (fndecl @@ -2282,9 +2282,10 @@ chkp_build_returned_bound (gcall *call) bounds = chkp_find_bounds (gimple_call_arg (call, argno), &iter); } - else if (chkp_call_returns_bounds_p (call)) + else if (chkp_call_returns_bounds_p (call) + && BOUNDED_P (lhs)) { - gcc_assert (TREE_CODE (gimple_call_lhs (call)) == SSA_NAME); + gcc_assert (TREE_CODE (lhs) == SSA_NAME); /* In general case build checker builtin call to obtain returned bounds. */ @@ -2311,7 +2312,7 @@ chkp_build_returned_bound (gcall *call) print_gimple_stmt (dump_file, call, 0, TDF_VOPS|TDF_MEMSYMS); } - bounds = chkp_maybe_copy_and_register_bounds (gimple_call_lhs (call), bounds); + bounds = chkp_maybe_copy_and_register_bounds (lhs, bounds); return bounds; } |